[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190719073316.GA4012@piout.net>
Date: Fri, 19 Jul 2019 09:33:16 +0200
From: Alexandre Belloni <alexandre.belloni@...tlin.com>
To: Anson.Huang@....com
Cc: a.zummo@...ertech.it, linux-rtc@...r.kernel.org,
linux-kernel@...r.kernel.org, Linux-imx@....com
Subject: Re: [PATCH V2] rtc: snvs: fix possible race condition
On 19/07/2019 11:01:02+0800, Anson.Huang@....com wrote:
> From: Anson Huang <Anson.Huang@....com>
>
> 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 and register rtc
> device before requesting the RTC IRQ.
>
> Using devm_rtc_allocate_device/rtc_register_device instead of
> devm_rtc_device_register.
>
> Signed-off-by: Anson Huang <Anson.Huang@....com>
> ---
> Changes since V1:
> - move devm_request_irq() to after rtc device register done, make sure everything
> is ready before enabling IRQ.
This opens another race condition, the first version of the patch was
correct.
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Powered by blists - more mailing lists