rtc: pl030: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 9 Sep 2018 20:38:47 +0000 (22:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Nov 2019 16:59:51 +0000 (17:59 +0100)
commitc07f8f5046a38b4b0d57ecbca18367a1ac129f3c
tree65afbbc8693f89f177f2ccfd58e067a7d39254ab
parent9a7a5487408d0d0fb4a269085f36f1129f3b8538
rtc: pl030: fix possible race condition

[ Upstream commit c778ec85825dc895936940072aea9fe9037db684 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/rtc/rtc-pl030.c