lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210714100422.000051a2@Huawei.com>
Date:   Wed, 14 Jul 2021 10:04:22 +0100
From:   Jonathan Cameron <Jonathan.Cameron@...wei.com>
To:     Pavel Machek <pavel@...x.de>
CC:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        <linux-kernel@...r.kernel.org>, <stable@...r.kernel.org>,
        frank zago <frank@...o.net>
Subject: Re: [PATCH 5.10 073/593] iio: light: tcs3472: do not free
 unallocated IRQ

On Tue, 13 Jul 2021 23:31:28 +0200
Pavel Machek <pavel@...x.de> wrote:

> Hi!
> 
> > commit 7cd04c863f9e1655d607705455e7714f24451984 upstream.
> > 
> > Allocating an IRQ is conditional to the IRQ existence, but freeing it
> > was not. If no IRQ was allocate, the driver would still try to free
> > IRQ 0. Add the missing checks.
> > 
> > This fixes the following trace when the driver is removed:
> > 
> > [  100.667788] Trying to free already-free IRQ 0  
> 
> AFAICT this will need more fixing, because IRQ == 0 is a valid
> IRQ. NO_IRQ (aka -1) should be safe to use for "no irq assigned".
> 

I thought we had long put this to bed.  IRQ == 0 is not a valid irq number.
If there is an error in parsing DT (e.g. no irq specified) it returns 0
not NO_IRQ.  Naturally irq chips can have a 0, but that's pre translation to
virtual IRQ space.

Many years ago, ARM did have 0 as as valid IRQ, but that got cleaned up
to make it easier to do generic code like this.

Jonathan


> Best regards,
> 								Pavel
> 
> > +++ b/drivers/iio/light/tcs3472.c
> > @@ -531,7 +531,8 @@ static int tcs3472_probe(struct i2c_clie
> >  	return 0;
> >  
> >  free_irq:
> > -	free_irq(client->irq, indio_dev);
> > +	if (client->irq)
> > +		free_irq(client->irq, indio_dev);
> >  buffer_cleanup:
> >  	iio_triggered_buffer_cleanup(indio_dev);
> >  	return ret;  
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ