mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
rtc-cmos: do dev_set_drvdata() earlier in the initialization
The bug is an oops when dev_get_drvdata() returned null in
cmos_update_irq_enable(). The call tree looks like this:
rtc_dev_ioctl()
=> rtc_update_irq_enable()
=> cmos_update_irq_enable()
It's caused by a race condition in the module initialization. It is
rtc_device_register() which makes the ioctl operations live so I moved
the call to dev_set_drvdata() before the call to rtc_device_register().
Addresses https://bugzilla.kernel.org/show_bug.cgi?id=15963
Reported-by: Randy Dunlap <[email protected]>
Signed-off-by: Dan Carpenter <[email protected]>
Tested-by: Randy Dunlap <[email protected]>
Cc: Alessandro Zummo <[email protected]>
Cc: Paul Gortmaker <[email protected]>
Cc: Malte Schroder <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: Herton Ronaldo Krzesinski <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
72cc8e51cf
commit
6ba8bcd457
1 changed files with 3 additions and 2 deletions
|
|
@ -719,6 +719,9 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
|
|||
}
|
||||
}
|
||||
|
||||
cmos_rtc.dev = dev;
|
||||
dev_set_drvdata(dev, &cmos_rtc);
|
||||
|
||||
cmos_rtc.rtc = rtc_device_register(driver_name, dev,
|
||||
&cmos_rtc_ops, THIS_MODULE);
|
||||
if (IS_ERR(cmos_rtc.rtc)) {
|
||||
|
|
@ -726,8 +729,6 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
|
|||
goto cleanup0;
|
||||
}
|
||||
|
||||
cmos_rtc.dev = dev;
|
||||
dev_set_drvdata(dev, &cmos_rtc);
|
||||
rename_region(ports, dev_name(&cmos_rtc.rtc->dev));
|
||||
|
||||
spin_lock_irq(&rtc_lock);
|
||||
|
|
|
|||
Loading…
Reference in a new issue