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: <1401514810.9728.163.camel@LTIRV-MCHAN1.corp.ad.broadcom.com>
Date:	Fri, 30 May 2014 22:40:09 -0700
From:	Michael Chan <mchan@...adcom.com>
To:	Benjamin Poirier <benjamin.poirier@...il.com>
CC:	<davem@...emloft.net>, <netdev@...r.kernel.org>,
	<nhorman@...driver.com>
Subject: Re: [PATCH 2/3] cnic: Don't take cnic_dev_lock in
 cnic_alloc_uio_rings()

On Fri, 2014-05-30 at 15:50 -0700, Benjamin Poirier wrote: 
> On 2014/05/30 16:18, Michael Chan wrote:
> > We are allocating memory with GFP_KERNEL under spinlock.  Since this is
> > the only call manipulating the cnic_udev_list and it is always under
> > rtnl_lock, cnic_dev_lock can be safely removed.
> > 
> > Signed-off-by: Michael Chan <mchan@...adcom.com>
> > ---
> >  drivers/net/ethernet/broadcom/cnic.c |    6 ------
> >  1 files changed, 0 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/broadcom/cnic.c b/drivers/net/ethernet/broadcom/cnic.c
> > index 7f40a2c..4ebab75 100644
> > --- a/drivers/net/ethernet/broadcom/cnic.c
> > +++ b/drivers/net/ethernet/broadcom/cnic.c
> > @@ -1039,21 +1039,17 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
> >  	struct cnic_local *cp = dev->cnic_priv;
> >  	struct cnic_uio_dev *udev;
> >  
> > -	read_lock(&cnic_dev_lock);
> >  	list_for_each_entry(udev, &cnic_udev_list, list) {
> >  		if (udev->pdev == dev->pcidev) {
> >  			udev->dev = dev;
> >  			if (__cnic_alloc_uio_rings(udev, pages)) {
> >  				udev->dev = NULL;
> > -				read_unlock(&cnic_dev_lock);
> >  				return -ENOMEM;
> >  			}
> >  			cp->udev = udev;
> > -			read_unlock(&cnic_dev_lock);
> >  			return 0;
> >  		}
> >  	}
> > -	read_unlock(&cnic_dev_lock);
> >  
> >  	udev = kzalloc(sizeof(struct cnic_uio_dev), GFP_ATOMIC);
> 
> Oh, and you could also make the above GFP_KERNEL. Sorry for not
> mentioning it in my previous mail.

Thanks for pointing this out.  We can do that in a separate patch.  It
is related but not part of this bug fix.


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ