diff options
author | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-02-21 11:57:05 +0100 |
---|---|---|
committer | Alexandre Belloni <alexandre.belloni@bootlin.com> | 2018-03-17 14:20:42 +0100 |
commit | 201fac95e799c3d0304ec724d555e1251b9f6e84 (patch) | |
tree | 1b6758467df034e9207fe9a083faabaccb3bda5e /drivers/ipack | |
parent | 4cda172bc338abf770dcdbcf61049ef0d76b17fc (diff) | |
download | linux-201fac95e799c3d0304ec724d555e1251b9f6e84.tar.bz2 |
rtc: rk808: fix possible race condition
The probe function is not allowed to fail after registering the RTC because
the following may happen:
CPU0: CPU1:
sys_load_module()
do_init_module()
do_one_initcall()
cmos_do_probe()
rtc_device_register()
__register_chrdev()
cdev->owner = struct module*
open("/dev/rtc0")
rtc_device_unregister()
module_put()
free_module()
module_free(mod->module_core)
/* struct module *module is now
freed */
chrdev_open()
spin_lock(cdev_lock)
cdev_get()
try_module_get()
module_is_live()
/* dereferences already
freed struct module* */
Switch to devm_rtc_allocate_device/rtc_register_device to register the rtc
as late as possible.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/ipack')
0 files changed, 0 insertions, 0 deletions