]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
rtc: snvs: fix possible race condition
authorAnson Huang <Anson.Huang@nxp.com>
Tue, 16 Jul 2019 07:18:58 +0000 (15:18 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 18 Oct 2019 08:26:23 +0000 (04:26 -0400)
commit168b2c7d14e48478e363b8d6e88b9f78f555ba1f
tree72cbdd3da82eeb51a5378bd3c9a868311c15fc33
parent304402c83f9fadf7e69afe0c74a29e98ed00949c
rtc: snvs: fix possible race condition

BugLink: https://bugs.launchpad.net/bugs/1848047
[ Upstream commit 6fd4fe9b496d9ba3382992ff4fde3871d1b6f63d ]

The RTC IRQ is requested before the struct rtc_device is allocated,
this may lead to a NULL pointer dereference in IRQ handler.

To fix this issue, allocating the rtc_device struct before requesting
the RTC IRQ using devm_rtc_allocate_device, and use rtc_register_device
to register the RTC device.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>
Link: https://lore.kernel.org/r/20190716071858.36750-1-Anson.Huang@nxp.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/rtc/rtc-snvs.c