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]
Message-ID: <CE371C1263339941885964188A0225FA336142@CHN-SV-EXMX03.mchp-main.com>
Date:   Tue, 12 Sep 2017 13:01:17 +0000
From:   <Nisar.Sayed@...rochip.com>
To:     <andrew@...n.ch>
CC:     <davem@...emloft.net>, <UNGLinuxDriver@...rochip.com>,
        <netdev@...r.kernel.org>
Subject: RE: [PATCH v2 net 1/3] lan78xx: Fix for eeprom read/write when
 device auto suspend

> > From: Nisar Sayed <Nisar.Sayed@...rochip.com>
> >
> > Fix for eeprom read/write when device auto suspend
> >
> > Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to
> > 10/100/1000 Ethernet device driver")
> > Signed-off-by: Nisar Sayed <Nisar.Sayed@...rochip.com>
> > ---
> >  drivers/net/usb/lan78xx.c | 22 ++++++++++++++++++----
> >  1 file changed, 18 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
> > index b99a7fb..baf91c7 100644
> > --- a/drivers/net/usb/lan78xx.c
> > +++ b/drivers/net/usb/lan78xx.c
> > @@ -1265,30 +1265,44 @@ static int lan78xx_ethtool_get_eeprom(struct
> net_device *netdev,
> >  				      struct ethtool_eeprom *ee, u8 *data)  {
> >  	struct lan78xx_net *dev = netdev_priv(netdev);
> > +	int ret = -EINVAL;
> > +
> > +	if (usb_autopm_get_interface(dev->intf) < 0)
> > +		return ret;
> 
> Hi Nisar
> 
> It is better to do
> 
>    ret = usb_autopm_get_interface(dev->intf;
>    if (ret)
>         return ret;
> 
> i.e. use the error code usb_autopm_get_interface() gives you.
> 
> >  	ee->magic = LAN78XX_EEPROM_MAGIC;
> >
> > -	return lan78xx_read_raw_eeprom(dev, ee->offset, ee->len, data);
> > +	ret = lan78xx_read_raw_eeprom(dev, ee->offset, ee->len, data);
> > +
> > +	usb_autopm_put_interface(dev->intf);
> > +
> > +	return ret;
> >  }
> >
> >  static int lan78xx_ethtool_set_eeprom(struct net_device *netdev,
> >  				      struct ethtool_eeprom *ee, u8 *data)  {
> >  	struct lan78xx_net *dev = netdev_priv(netdev);
> > +	int ret = -EINVAL;
> > +
> > +	if (usb_autopm_get_interface(dev->intf) < 0)
> > +		return ret;
> 
> Same here.
> 
>      Andrew

Thanks Andrew, will update it.

- Nisar

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ