mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Abdelnasser Hussein <abdelnasserhussein11@gmail.com>,
	linux-iio@vger.kernel.org, dlechner@baylibre.com,
	nuno.sa@analog.com, andy@kernel.org, nicolas.ferre@microchip.com,
	alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev,
	giorgitchankvetadze1997@gmail.com, amin.gattout@gmail.com,
	antoniu.miclaus@analog.com, gregkh@linuxfoundation.org,
	mripard@kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 1/3] iio: adc: at91_adc: fix NULL pointer dereference on trigger remove
Date: Mon, 23 Nov 2026 11:31:41 +0200	[thread overview]
Message-ID: <awQH_Rr8b_Eu0Vew@ashevche-desk.local> (raw)
In-Reply-To: <20261122002118.723b23b3@jic23-hlaptop>

On Sun, Nov 22, 2026 at 12:21:18AM +0000, Jonathan Cameron wrote:
> On Tue, 17 Nov 2026 18:45:29 +0200
> Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> > On Tue, Nov 17, 2026 at 06:44:37PM +0200, Andy Shevchenko wrote:
> > > On Tue, Nov 17, 2026 at 04:05:08PM +0200, Abdelnasser Hussein wrote:  

...

> > > >  	for (i = 0; i < st->caps->trigger_number; i++) {
> > > > +		if (!st->trig[i])
> > > > +			continue;
> > > >  		iio_trigger_unregister(st->trig[i]);
> > > >  		iio_trigger_free(st->trig[i]);
> > > >  	}  
> > > 
> > > Yes, but no. Please, rather fix the above mentioned IIO trigger APIs to be
> > > NULL-aware.  
> > 
> > Actually the iio_trigger_free() is already NULL-aware, so make it only for
> > iio_trigger_unregister().
> 
> I'd rather we didn't.  Any code that is unregistering a trigger
> that it didn't register is probably really very very buggy.
> I'd like them to crash or at least guarantee that sashiko
> flags it.  We could add a warn if it is called on NULL I suppose
> but that is ugly.

Can we add a comment there to avoid making such a change explaining
why we won't iio_trigger_unregister() be NULL-aware?

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-11-23  9:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-17 14:05 [PATCH v4 0/3] iio: adc: at91_adc: fix trigger NULL deref and convert to devm_* Abdelnasser Hussein
2026-11-17 14:05 ` [PATCH v4 1/3] iio: adc: at91_adc: fix NULL pointer dereference on trigger remove Abdelnasser Hussein
2026-11-17 16:44   ` Andy Shevchenko
2026-11-17 16:45     ` Andy Shevchenko
2026-11-22  0:21       ` Jonathan Cameron
2026-11-23  9:31         ` Andy Shevchenko [this message]
2026-11-17 14:05 ` [PATCH v4 2/3] iio: adc: at91_adc: use local struct device pointer in probe Abdelnasser Hussein
2026-11-17 16:50   ` Andy Shevchenko
2026-11-17 14:05 ` [PATCH v4 3/3] iio: adc: at91_adc: convert to device-managed resources Abdelnasser Hussein
2026-11-17 16:57   ` Andy Shevchenko
2026-11-22  0:23   ` Jonathan Cameron

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=awQH_Rr8b_Eu0Vew@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=abdelnasserhussein11@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=amin.gattout@gmail.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=dlechner@baylibre.com \
    --cc=giorgitchankvetadze1997@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mripard@kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=nuno.sa@analog.com \
    /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

all inboxes | Powered by JetHome®