]> www.infradead.org Git - users/jedix/linux-maple.git/commit
rtc: sunxi: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 4 Jun 2018 12:05:40 +0000 (14:05 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 4 Jun 2018 12:36:14 +0000 (14:36 +0200)
commit29615d03ccc0f8f01b45178737600810d8bf971f
tree5eeb0fd992473e03dc6a711c8b8e1bf30a9d543c
parent696fa1d043ecd605166cc97b24c0b7a59dd5a135
rtc: sunxi: 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
before requesting the IRQ.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-sunxi.c