]> git.baikalelectronics.ru Git - kernel.git/commit
rtc: digicolor: fix possible race condition
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Tue, 30 Apr 2019 09:32:09 +0000 (11:32 +0200)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Wed, 8 May 2019 20:13:37 +0000 (22:13 +0200)
commit8ef81631d7eb13a1442c491048ef0e1593958621
tree2ea6a0a993fd6bb7fe1ec2f2141994b652029b40
parent44dcc3cdf5fd6a453363ad389012f88414941fdb
rtc: digicolor: fix possible race condition

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
struct before requesting the IRQ.

Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-digicolor.c