]> git.proxmox.com Git - mirror_ubuntu-bionic-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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 16 Oct 2019 09:55:43 +0000 (11:55 +0200)
commit1a13e64864334f80e9f35f00db69ef19b3ea81a0
tree2eee22e21788e87c06e1a0b683dbc5d16b6f19b6
parent9131a707d9cd094710f5c0f024e8637bf3566b45
rtc: snvs: fix possible race condition

BugLink: https://bugs.launchpad.net/bugs/1848274
[ 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: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/rtc/rtc-snvs.c