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]
Date:	Wed, 16 Jul 2014 15:38:24 +0200
From:	Frank Haverkamp <haver@...ux.vnet.ibm.com>
To:	Sebastian Ott <sebott@...ux.vnet.ibm.com>
Cc:	Alexander Gordeev <agordeev@...hat.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] misc/GenWQE: fix pci_enable_msi usage

Hi Sebastian,

Am Mittwoch, den 09.07.2014, 13:44 +0200 schrieb Sebastian Ott:
> On Wed, 9 Jul 2014, Alexander Gordeev wrote:
> 
> > On Wed, Jul 09, 2014 at 12:46:39PM +0200, Sebastian Ott wrote:
> > > GenWQE used to call pci_enable_msi_block to allocate a desired number
> > > of MSI's. If that was not possible pci_enable_msi_block returned with a
> > > smaller number which might be possible to allocate. GenWQE then called
> > > pci_enable_msi_block with that number.
> > > 
> > > Since commit a30d0108b
> > > "GenWQE: Use pci_enable_msi_exact() instead of pci_enable_msi_block()"
> > > pci_enable_msi_exact is used which fails if the desired number of MSI's
> > > was not possible to allocate. Change GenWQE to use pci_enable_msi_range
> > > to restore the old behavior.
> > > 
> > > Signed-off-by: Sebastian Ott <sebott@...ux.vnet.ibm.com>
> > > ---
> > >  drivers/misc/genwqe/card_ddcb.c  |  4 +---
> > >  drivers/misc/genwqe/card_utils.c | 10 ++++++----
> > >  2 files changed, 7 insertions(+), 7 deletions(-)
> > > 
> > > diff --git a/drivers/misc/genwqe/card_ddcb.c b/drivers/misc/genwqe/card_ddcb.c
> > > index c8046db..f66d43d 100644
> > > --- a/drivers/misc/genwqe/card_ddcb.c
> > > +++ b/drivers/misc/genwqe/card_ddcb.c
> > > @@ -1237,9 +1237,7 @@ int genwqe_setup_service_layer(struct genwqe_dev *cd)
> > >  	}
> > >  
> > >  	rc = genwqe_set_interrupt_capability(cd, GENWQE_MSI_IRQS);
> > > -	if (rc > 0)
> > > -		rc = genwqe_set_interrupt_capability(cd, rc);
> > > -	if (rc != 0) {
> > > +	if (rc) {
> > >  		rc = -ENODEV;
> > >  		goto stop_kthread;
> > >  	}
> > > diff --git a/drivers/misc/genwqe/card_utils.c b/drivers/misc/genwqe/card_utils.c
> > > index 62cc6bb..6abc437 100644
> > > --- a/drivers/misc/genwqe/card_utils.c
> > > +++ b/drivers/misc/genwqe/card_utils.c
> > > @@ -718,10 +718,12 @@ int genwqe_set_interrupt_capability(struct genwqe_dev *cd, int count)
> > >  	int rc;
> > >  	struct pci_dev *pci_dev = cd->pci_dev;
> > >  
> > > -	rc = pci_enable_msi_exact(pci_dev, count);
> > > -	if (rc == 0)
> > > -		cd->flags |= GENWQE_FLAG_MSI_ENABLED;
> > > -	return rc;
> > > +	rc = pci_enable_msi_range(pci_dev, 1, count);
> > > +	if (rc < 0)
> > > +		return rc;
> > > +
> > > +	cd->flags |= GENWQE_FLAG_MSI_ENABLED;
> > > +	return 0;
> > >  }
> > >  
> > >  /**
> > > -- 
> > > 1.9.3
> > > 
> > 
> > Reviewed-by: Alexander Gordeev <agordeev@...hat.com>
> > 

thanks for the fix and Alexander for reviewing it.

> > I am curious though why would you need convert error code to -ENODEV here
> > (and throughout the code in general)?
> 
> Yes, I thought about that too but decided to just fix the bug and not
> change this (since it's more or less unrelated).
> 
> Regards,
> Sebastian

You are probably right, converting the return code into -ENODEV is not
really needed.

Reviewed-by: Frank Haverkamp <haver@...ux.vnet.ibm.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ