]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: sh: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 20 Mar 2019 11:30:09 +0000 (12:30 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Thu, 4 Apr 2019 08:07:09 +0000 (10:07 +0200)
commit9b496aaf1d24173a0ba70213c5df9d7704be43b4
treedbaf06cbb95fd81e353363c4a45c3bd8bb50f9c5
parent8dd21a9865d2fb5362215e6c477589f3f0927ea1
rtc: sh: fix possible race condition

The IRQ is requested before the struct rtc is allocated and registered, but
this struct is used in the IRQ handler. This may lead to a NULL pointer
dereference.

Switch to devm_rtc_allocate_device/rtc_register_device to allocate the rtc
struct before requesting the IRQ.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-sh.c