Re: [PATCH] mfd: menelaus: fix possible race condition and leak
From: Lee Jones
Date: Tue Sep 11 2018 - 11:40:02 EST
On Sun, 09 Sep 2018, Alexandre Belloni wrote:
> The IRQ work is added 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
> before calling menelaus_add_irq_work.
>
> Also, this solves a possible leak as the RTC is never released.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
> ---
>
> Lee,
>
> If that is ok with you, I would like to take this patch through the RTC
> tree. So I can have a follow up patch removing rtc_device_register().
>
> Thanks
>
> drivers/mfd/menelaus.c | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
Applied, thanks.
--
Lee Jones [æçæ]
Linaro Services Technical Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog