]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
rtc: mt6397: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 9 Sep 2018 20:38:46 +0000 (22:38 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 26 Nov 2019 12:16:33 +0000 (13:16 +0100)
commit333259a982cc3d5db789213754a529cf20d93cc3
treea5f1b4c80d448ebf803fdc8f9fe3af09cb66138e
parentddfb1afc2b413ba2f3ee54be59340fcd7f30b630
rtc: mt6397: fix possible race condition

BugLink: https://bugs.launchpad.net/bugs/1853915
[ Upstream commit babab2f86440352d24e76118fdd7d40cab5fd7bf ]

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.

Acked-by: Eddie Huang <eddie.huang@mediatek.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/rtc/rtc-mt6397.c