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: <YQl8Pr42Oj4PafFP@carbon>
Date:   Tue, 3 Aug 2021 20:26:22 +0300
From:   Petko Manolov <petko.manolov@...sulko.com>
To:     Pavel Skripkin <paskripkin@...il.com>
Cc:     netdev@...r.kernel.org, davem@...emloft.net,
        gregkh@...uxfoundation.org, Petko Manolov <petkan@...leusys.com>
Subject: Re: [PATCH net v2 1/2] Check the return value of get_geristers() and
 friends;

On 21-08-03 19:45:56, Pavel Skripkin wrote:
> On 8/3/21 7:18 PM, Petko Manolov wrote:
> > From: Petko Manolov <petkan@...leusys.com>
> > 
> > Certain call sites of get_geristers() did not do proper error handling.  This
> > could be a problem as get_geristers() typically return the data via pointer to a
> > buffer.  If an error occured the code is carelessly manipulating the wrong data.
> > 
> > Signed-off-by: Petko Manolov <petkan@...leusys.com>
> > ---
> >   drivers/net/usb/pegasus.c | 104 ++++++++++++++++++++++++++------------
> >   1 file changed, 72 insertions(+), 32 deletions(-)
> > 
> > diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
> > index 9a907182569c..06e3ae6209b0 100644
> > --- a/drivers/net/usb/pegasus.c
> > +++ b/drivers/net/usb/pegasus.c
> > @@ -132,9 +132,15 @@ static int get_registers(pegasus_t *pegasus, __u16 indx, __u16 size, void *data)
> >   static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size,
> >   			 const void *data)
> >   {
> > -	return usb_control_msg_send(pegasus->usb, 0, PEGASUS_REQ_SET_REGS,
> > +	int ret;
> > +
> > +	ret = usb_control_msg_send(pegasus->usb, 0, PEGASUS_REQ_SET_REGS,
> >   				    PEGASUS_REQT_WRITE, 0, indx, data, size,
> >   				    1000, GFP_NOIO);
> > +	if (ret < 0)
> > +		netif_dbg(pegasus, drv, pegasus->net, "%s failed with %d\n", __func__, ret);
> > +
> > +	return ret;
> >   }
> >   /*
> > @@ -145,10 +151,15 @@ static int set_registers(pegasus_t *pegasus, __u16 indx, __u16 size,
> >   static int set_register(pegasus_t *pegasus, __u16 indx, __u8 data)
> >   {
> >   	void *buf = &data;
> > +	int ret;
> > -	return usb_control_msg_send(pegasus->usb, 0, PEGASUS_REQ_SET_REG,
> > +	ret = usb_control_msg_send(pegasus->usb, 0, PEGASUS_REQ_SET_REG,
> >   				    PEGASUS_REQT_WRITE, data, indx, buf, 1,
> >   				    1000, GFP_NOIO);
> > +	if (ret < 0)
> > +		netif_dbg(pegasus, drv, pegasus->net, "%s failed with %d\n", __func__, ret);
> > +
> > +	return ret;
> >   }
> >   static int update_eth_regs_async(pegasus_t *pegasus)
> > @@ -188,10 +199,9 @@ static int update_eth_regs_async(pegasus_t *pegasus)
> >   static int __mii_op(pegasus_t *p, __u8 phy, __u8 indx, __u16 *regd, __u8 cmd)
> >   {
> > -	int i;
> > -	__u8 data[4] = { phy, 0, 0, indx };
> > +	int i, ret = -ETIMEDOUT;
> >   	__le16 regdi;
> > -	int ret = -ETIMEDOUT;
> > +	__u8 data[4] = { phy, 0, 0, indx };
> >   	if (cmd & PHY_WRITE) {
> >   		__le16 *t = (__le16 *) & data[1];
> > @@ -211,8 +221,9 @@ static int __mii_op(pegasus_t *p, __u8 phy, __u8 indx, __u16 *regd, __u8 cmd)
> >   		goto fail;
> 		^^^^^^^^^
> 
> I really don't want You to spin this series one more time, but ret
> initialization is missed here again :) Maybe, it's not really important
> here...

I'll respin this as many times as needed. :)

> And Fixes or CC stable is missed too

Done.


cheers,
Petko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ