linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-iio <linux-iio@vger.kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	"Peter Meerwald-Stadler" <pmeerw@pmeerw.net>,
	Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH v1 1/5] iio: pressure: bmp280: Tolerate IRQ before registering
Date: Mon, 23 Mar 2020 09:40:18 +0000	[thread overview]
Message-ID: <20200323094018.00002190@Huawei.com> (raw)
In-Reply-To: <CAHp75VcUPSmCnKFSm8y6Nq_qCcMHHihACC+49FyzrawAqMjQDA@mail.gmail.com>

On Sun, 22 Mar 2020 23:15:13 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Sun, Mar 22, 2020 at 7:14 PM Jonathan Cameron <jic23@kernel.org> wrote:
> > On Tue, 17 Mar 2020 12:18:09 +0200
> > Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >  
> > > With DEBUG_SHIRQ enabled we have a kernel crash
> > >
> > > [  116.482696] BUG: kernel NULL pointer dereference, address: 0000000000000000
> > >
> > > ...
> > >
> > > [  116.606571] Call Trace:
> > > [  116.609023]  <IRQ>
> > > [  116.611047]  complete+0x34/0x50
> > > [  116.614206]  bmp085_eoc_irq+0x9/0x10 [bmp280]
> > >
> > > because DEBUG_SHIRQ mechanism fires an IRQ before registration and drivers
> > > ought to be able to handle an interrupt happening before request_irq() returns.
> > >
> > > Fixes: aae953949651 ("iio: pressure: bmp280: add support for BMP085 EOC interrupt")
> > > Cc: Linus Walleij <linus.walleij@linaro.org>
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>  
> >
> > Hmm. Nasty corner case but fair enough to fix it up.
> > I guess we should audit other drivers for similar paths...  
> 
> One can easily test, no device even needed (however in this case I have one)
> 
> ...
> 
> > > -     if (data->use_eoc)
> > > -             init_completion(&data->done);
> > > +     reinit_completion(&data->done);  
> >
> > reinit on the completion when we don't even have an interrupt
> > (hence data->use_eoc == false) seems excessive.  Why did
> > you drop the conditional?  
> 
> It's harmless and gives less code I believe.
> But if you insist I can put it back.
> 

I agree it's harmless but breaks the logical flow by doing
something unnecessary so either we need a comment to say that
or easier option, just put the condition back in.

Jonathan



  reply	other threads:[~2020-03-23  9:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-17 10:18 [PATCH v1 1/5] iio: pressure: bmp280: Tolerate IRQ before registering Andy Shevchenko
2020-03-17 10:18 ` [PATCH v1 2/5] iio: pressure: bmp280: Use IIO_DEVICE_ATTR_RO macro Andy Shevchenko
2020-03-22 17:16   ` Jonathan Cameron
2020-03-22 21:17     ` Andy Shevchenko
2020-03-23  9:38       ` Jonathan Cameron
2020-03-17 10:18 ` [PATCH v1 3/5] iio: pressure: bmp280: Explicitly mark GPIO optional Andy Shevchenko
2020-03-17 10:18 ` [PATCH v1 4/5] iio: pressure: bmp280: Drop unneeded explicit castings Andy Shevchenko
2020-03-22 17:21   ` Jonathan Cameron
2020-03-22 21:20     ` Andy Shevchenko
2020-03-17 10:18 ` [PATCH v1 5/5] iio: pressure: bmp280: Join string literals back Andy Shevchenko
2020-03-22 17:12 ` [PATCH v1 1/5] iio: pressure: bmp280: Tolerate IRQ before registering Jonathan Cameron
2020-03-22 21:15   ` Andy Shevchenko
2020-03-23  9:40     ` Jonathan Cameron [this message]
2020-03-23 10:08       ` Andy Shevchenko

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=20200323094018.00002190@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).