]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: sa1100: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Fri, 6 Mar 2020 01:01:44 +0000 (02:01 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Mon, 16 Mar 2020 10:12:09 +0000 (11:12 +0100)
commit717e28f45f6a23637fe3dad1066c49c6f147b77c
tree3deabb27fff17fee84aadab8dbd2bdc4d5a73efc
parent9a689e413d3a81dcf62e56f5facc4e7b21a1bf55
rtc: sa1100: fix possible race condition

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

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

Link: https://lore.kernel.org/r/20200306010146.39762-1-alexandre.belloni@bootlin.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-sa1100.c