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: <20200313191230.qrrlo7ht24fhfhvj@rric.localdomain>
Date:   Fri, 13 Mar 2020 20:12:31 +0100
From:   Robert Richter <rrichter@...vell.com>
To:     Tim Harvey <tharvey@...eworks.com>
CC:     Linus Walleij <linus.walleij@...aro.org>,
        Lokesh Vutla <lokeshvutla@...com>,
        <linux-gpio@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] gpio: thunderx: fix irq_request_resources

On 13.03.20 16:31:51, Robert Richter wrote:
> On 11.03.20 08:43:53, Tim Harvey wrote:
> > If there are no parent resources do not call irq_chip_request_resources_parent
> > at all as this will return an error.
> > 
> > This resolves a regression where devices using a thunderx gpio as an interrupt
> > would fail probing.
> > 
> > Fixes: 0d04d0c ("gpio: thunderx: Use the default parent apis for {request,release}_resources")
> > Signed-off-by: Tim Harvey <tharvey@...eworks.com>
> > ---
> >  drivers/gpio/gpio-thunderx.c | 9 ++++++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpio/gpio-thunderx.c b/drivers/gpio/gpio-thunderx.c
> > index 4627704..f84b9b1 100644
> > --- a/drivers/gpio/gpio-thunderx.c
> > +++ b/drivers/gpio/gpio-thunderx.c
> > @@ -366,15 +366,18 @@ static int thunderx_gpio_irq_request_resources(struct irq_data *data)
> >  {
> >  	struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
> >  	struct thunderx_gpio *txgpio = txline->txgpio;
> > +	struct irq_data *parent_data = data->parent_data;
> >  	int r;
> >  
> >  	r = gpiochip_lock_as_irq(&txgpio->chip, txline->line);
> >  	if (r)
> >  		return r;
> >  
> > -	r = irq_chip_request_resources_parent(data);
> > -	if (r)
> > -		gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
> > +	if (parent_data && parent_data->chip->irq_request_resources) {
> > +		r = irq_chip_request_resources_parent(data);
> > +		if (r)
> > +			gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
> > +	}
> 
> There is no unlocking for the else case. I would assume the
> parent_data should be checked before grabbing the lock, or is this
> intended?

Looking at the original code, the parent resources are requested only
if existing. So the change is ok.

On the other hand, the overall change using irq_chip_{request,
release}_resources_parent() became pointless now. It is unreadable and
more complex now. Thus, commit 0d04d0c should just be reverted.

The function interface is limited. Instead of letting the child device
deal with the parent, parent requests should be handled directly in
irq_request_resources(). Another aspect is that the code for this
driver has been already removed upstream and ti_sci_inta_msi.c is the
last remaining user of it. This speaks also for a removal by a revert.

Thanks,

-Robert

> >  
> >  	return r;
> >  }
> > -- 
> > 2.7.4
> > 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ