diff options
| author | Alexandre Belloni <[email protected]> | 2018-02-12 23:47:45 +0100 |
|---|---|---|
| committer | Alexandre Belloni <[email protected]> | 2018-03-01 10:49:29 +0100 |
| commit | 53d29e0a3afe0567db9e4360e8523b092eb2d4e4 (patch) | |
| tree | dacc451b5910022aae5fb25acf00a59672f6d19f /tools/perf/scripts/python/call-graph-from-sql.py | |
| parent | 1af7068d2a19d333e9280f8a43bc7215c90bfb91 (diff) | |
rtc: cmos: 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 <[email protected]>
Diffstat (limited to 'tools/perf/scripts/python/call-graph-from-sql.py')
0 files changed, 0 insertions, 0 deletions