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  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:   Wed, 28 Oct 2020 09:40:38 -0700
From:   Jakub Kicinski <kuba@...nel.org>
To:     Moritz Fischer <mdf@...nel.org>
Cc:     netdev@...r.kernel.org, davem@...emloft.net,
        linux-parisc@...r.kernel.org, linux-kernel@...r.kernel.org,
        lucyyan@...gle.com, moritzf@...gle.com,
        James.Bottomley@...senpartnership.com
Subject: Re: [PATCH/RFC net-next v3] net: dec: tulip: de2104x: Add shutdown
 handler to stop NIC

On Tue, 27 Oct 2020 18:59:09 -0700 Moritz Fischer wrote:
> Hi Jakub,
> 
> On Tue, Oct 27, 2020 at 04:16:06PM -0700, Jakub Kicinski wrote:
> > On Fri, 23 Oct 2020 13:28:34 -0700 Moritz Fischer wrote:  
> > > diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c
> > > index d9f6c19940ef..ea7442cc8e75 100644
> > > --- a/drivers/net/ethernet/dec/tulip/de2104x.c
> > > +++ b/drivers/net/ethernet/dec/tulip/de2104x.c
> > > @@ -2175,11 +2175,19 @@ static int __maybe_unused de_resume(struct device *dev_d)
> > >  
> > >  static SIMPLE_DEV_PM_OPS(de_pm_ops, de_suspend, de_resume);
> > >  
> > > +static void de_shutdown(struct pci_dev *pdev)
> > > +{
> > > +	struct net_device *dev = pci_get_drvdata(pdev);
> > > +
> > > +	de_close(dev);  
> > 
> > Apparently I get all the best ideas when I'm about to apply something..  
> 
> Better now than after =)
> 
> > I don't think you can just call de_close() like that, because 
> > (a) it may expect rtnl_lock() to be held, and (b) it may not be open.  
> 
> how about:
> 
> rtnl_lock();
> if (netif_running(dev))
> 	dev_close(dev);
> rtnl_unlock();

That's fine as well, although dev_close() checks if the device is UP
AFAICT.

Powered by blists - more mailing lists