]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: ds1374: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Fri, 6 Mar 2020 07:34:01 +0000 (08:34 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 16 Mar 2020 10:12:10 +0000 (11:12 +0100)
commit3429e7ec13dd47bd12ffc587b0d0802d75ba0303
treeac8645196ed47c8c7c8cfe718a53449bfe004c5a
parent89c7381a495f90a3c8285c1f8ecab4a7d07c53bd
rtc: ds1374: fix possible race condition

The RTC IRQ is requested before the struct rtc_device is allocated,
this may lead to a NULL pointer dereference in the IRQ handler.

To fix this issue, allocating the rtc_device struct before requesting
the RTC IRQ using devm_rtc_allocate_device, and use rtc_register_device
to register the RTC device.

Link: https://lore.kernel.org/r/20200306073404.56921-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-ds1374.c