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:   Thu, 14 Jul 2022 18:17:41 +0000
From:   Joakim Tjernlund <Joakim.Tjernlund@...inera.com>
To:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "f.fainelli@...il.com" <f.fainelli@...il.com>
Subject: Re: network driver takedown at reboof -f ?

On Thu, 2022-07-14 at 10:26 -0700, Florian Fainelli wrote:
> On 7/14/22 10:16, Joakim Tjernlund wrote:
> > On Thu, 2022-07-14 at 07:58 -0700, Florian Fainelli wrote:
> > > 
> > > On 7/14/2022 7:21 AM, Joakim Tjernlund wrote:
> > > > Doing a fast reboot -f I notice that the ethernet I/Fs are NOT shutdown/stopped.
> > > > Is this expected? I sort of expected kernel to do ifconfig down automatically.
> > > > 
> > > > Is there some function in netdev I can hook into to make reboot shutdown my eth I/Fs?
> > > 
> > > If you want that to happen you typically have to implement a ->shutdown
> > > callback in your network driver registered via platform/pci/bus, if
> > > nothing else to turn off all DMAs and prevent, e.g.: a kexec'd kernel to
> > > be corrupted by a wild DMA engine still running.
> > > 
> > > There is no generic provision in the network stack to deal with those cases.
> > > 
> > > https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git%2Fcommit%2F%3Fid%3Dd9f45ab9e671166004b75427f10389e1f70cfc30&amp;data=05%7C01%7CJoakim.Tjernlund%40infinera.com%7Cce9406f685774ee5ed3308da65bdf31c%7C285643de5f5b4b03a1530ae2dc8aaf77%7C1%7C0%7C637934163771325940%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=KY1Xubz9tc0TQdOQTetQRruGgBxJOREM%2FHPrRPCHh6I%3D&amp;reserved=0
> > 
> > Exactly what I need, thank you :)
> > 
> > Trying to add a shutdown I have a problem getting at priv ptr:
> > static void ccip_shutdown(struct platform_device *pdev)
> > {
> > 	struct device *dev = &pdev->dev;
> > 	struct net_device *ndev = (void*)dev->parent;
> > 	struct ccip_priv *priv = netdev_priv(ndev);;
> > 
> > Above does not work, my probe has:
> > 	ndev = alloc_netdev(sizeof(struct ccip_priv), if_name,
> > 			    NET_NAME_UNKNOWN, ccip_init_dev);
> > 	priv = netdev_priv(ndev);
> >          SET_NETDEV_DEV(ndev, &pdev->dev);
> 
> How about platform_set_drvdata(&pdev->dev, priv) in probe, and in remove:
> 
> struct ccip_priv *priv = platform_get_drvdata(&pdev->dev);
> 
> does that work better?

Yes!. It works perfectly, thanks.

 Jocke

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ