All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: Anson.Huang@nxp.com
Cc: a.zummo@towertech.it, linux-rtc@vger.kernel.org,
	linux-kernel@vger.kernel.org, Linux-imx@nxp.com
Subject: Re: [PATCH V2] rtc: snvs: fix possible race condition
Date: Fri, 19 Jul 2019 09:33:16 +0200	[thread overview]
Message-ID: <20190719073316.GA4012@piout.net> (raw)
In-Reply-To: <20190719030102.6141-1-Anson.Huang@nxp.com>

On 19/07/2019 11:01:02+0800, Anson.Huang@nxp.com wrote:
> From: Anson Huang <Anson.Huang@nxp.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@nxp.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

  reply	other threads:[~2019-07-19  7:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19  3:01 [PATCH V2] rtc: snvs: fix possible race condition Anson.Huang
2019-07-19  7:33 ` Alexandre Belloni [this message]
2019-07-19  7:54   ` Anson Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190719073316.GA4012@piout.net \
    --to=alexandre.belloni@bootlin.com \
    --cc=Anson.Huang@nxp.com \
    --cc=Linux-imx@nxp.com \
    --cc=a.zummo@towertech.it \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.