Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rtc: Fix possible null pointer dereference in rtc-mpc5121.c

Mark Loard pointed out:
"For example, this beauty from rtc-mpc5121.c in the same update:
...
rtc->rtc = rtc_device_register("mpc5200-rtc", &op->dev,
&mpc5200_rtc_ops, THIS_MODULE);
...

rtc->rtc->uie_unsupported = 1; // <<<< Ooops NULL pointer >>>>

if (IS_ERR(rtc->rtc)) { // <<<< this needs to be earlier >>>>
err = PTR_ERR(rtc->rtc);
goto out_free_irq;
}
..."

This patch moves setting the uie_unsupported flag to after we validate
the rtc->rtc pointer to resolve this.

Reported by: Mark Lord <kernel@teksavvy.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Link: http://lkml.kernel.org/r/1335300215-21427-1-git-send-email-john.stultz@linaro.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

authored by

John Stultz and committed by
Thomas Gleixner
e48b5e82 a6371f80

+1 -2
+1 -2
drivers/rtc/rtc-mpc5121.c
··· 360 360 &mpc5200_rtc_ops, THIS_MODULE); 361 361 } 362 362 363 - rtc->rtc->uie_unsupported = 1; 364 - 365 363 if (IS_ERR(rtc->rtc)) { 366 364 err = PTR_ERR(rtc->rtc); 367 365 goto out_free_irq; 368 366 } 367 + rtc->rtc->uie_unsupported = 1; 369 368 370 369 return 0; 371 370