[PATCH v4 1/3] iio: adc: at91_adc: fix NULL pointer dereference on trigger remove

Jonathan Cameron jic23 at kernel.org
Sat Nov 28 16:18:35 PST 2026


On Mon, 23 Nov 2026 11:31:41 +0200
Andy Shevchenko <andriy.shevchenko at intel.com> wrote:

> 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 at 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?

I guess so given the question got raised.

Jonathan


> 




More information about the linux-arm-kernel mailing list