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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 28 Mar 2022 22:43:18 +0200
From:   Andrew Lunn <andrew@...n.ch>
To:     Michael Walle <michael@...le.cc>
Cc:     Horatiu Vultur <horatiu.vultur@...rochip.com>,
        "David S . Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, UNGLinuxDriver@...rochip.com,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net] net: lan966x: fix kernel oops on ioctl when I/F is
 down

> > So rather than testing of running, it would be better to test if the
> > phydev is NULL or not.
> 
> What about the following:
> 
> static int lan966x_port_ioctl(struct net_device *dev, struct ifreq *ifr,
> 			     int cmd)
> {
> 	struct lan966x_port *port = netdev_priv(dev);
> 
> 	if (!phy_has_hwtstamp(dev->phydev) && port->lan966x->ptp) {
> 		switch (cmd) {
> 		case SIOCSHWTSTAMP:
> 			return lan966x_ptp_hwtstamp_set(port, ifr);
> 		case SIOCGHWTSTAMP:
> 			return lan966x_ptp_hwtstamp_get(port, ifr);
> 		}
> 	}
> 
> 	if (!dev->phydev)
> 		return -ENODEV;
> 
> 	return phy_mii_ioctl(dev->phydev, ifr, cmd);

Yes, that is good.

     Andrew

Powered by blists - more mailing lists