Re: [PATCH] rtc: snvs: fix possible race condition

From: Alexandre Belloni
Date: Thu Aug 29 2019 - 11:39:51 EST


On 16/07/2019 15:18:58+0800, Anson.Huang@xxxxxxx wrote:
> From: Anson Huang <Anson.Huang@xxxxxxx>
>
> 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@xxxxxxx>
> ---
> drivers/rtc/rtc-snvs.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
>
Applied, thanks.

--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com