rtc: armada38x: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 24 Sep 2018 14:25:34 +0000 (16:25 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Nov 2019 17:47:52 +0000 (18:47 +0100)
commitba8c4cc746a55b7eec4d38baa6ca7769194b940a
tree0a7caa647defa2a8816cb6d853efc488bdac12aa
parent44bb1b1256b517315c9fba02029029a3f88f98e1
rtc: armada38x: fix possible race condition

[ Upstream commit 7d61cbb945a753af08e247b5f10bdd5dbb8d6c80 ]

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-armada38x.c