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] [day] [month] [year] [list]
Date:   Fri,  1 Jul 2022 10:31:28 +0200
From:   Piotr Skajewski <piotrx.skajewski@...el.com>
To:     kuba@...nel.org
Cc:     anthony.l.nguyen@...el.com, davem@...emloft.net,
        edumazet@...gle.com, konrad0.jankowski@...el.com,
        netdev@...r.kernel.org, pabeni@...hat.com,
        piotrx.skajewski@...el.com
Subject: Re: [PATCH net 1/1] ixgbe: Add locking to prevent panic when setting sriov_numvfs to zero

On Thu, 30 Jun 2022 08:11:34 -0700 Jakub Kicinski wrote:
> On Thu, 30 Jun 2022 12:08:39 +0200 Piotr Skajewski wrote:
> > On Tue, 28 Jun 2022 10:27:07 -0700 Jakub Kicinski wrote:
> > > On Tue, 28 Jun 2022 09:53:46 -0700 Tony Nguyen wrote:  
> > > > +	spin_lock_irqsave(&adapter->vfs_lock, flags);
> > > > +
> > > >  	/* set num VFs to 0 to prevent access to vfinfo */
> > > >  	adapter->num_vfs = 0;
> > > >  
> > > > @@ -228,6 +231,8 @@ int ixgbe_disable_sriov(struct ixgbe_adapter *adapter)
> > > >  	kfree(adapter->mv_list);
> > > >  	adapter->mv_list = NULL;
> > > >  
> > > > +	spin_unlock_irqrestore(&adapter->vfs_lock, flags);  
> > >
> > > There's a pci_dev_put() in there, are you sure it won't sleep?  
> > 
> > Thank Jakub for your notice, during development we were aware about this
> > and tests we've made on this particular case, did not report any problems
> > that could be related to might_sleep in conjunction with spinlock.
> 
> To be on the safe side how about we protect adapter->num_vfs instead 
> of adapter->vfinfo ?
> 
> You can hold the lock just around setting adapter->num_vfs to zero,
> and then inside ixgbe_msg_task() you don't have to add the new if()
> because the loop bound is already adapter->num_vfs.
> 
> Smaller change, and safer.

Yes sounds good, I will test it and prepare the patch.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ