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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220705203601.GA3184@amd>
Date:   Tue, 5 Jul 2022 22:36:02 +0200
From:   Pavel Machek <pavel@...x.de>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, stable@...r.kernel.org
Subject: Re: [PATCH 4.9 05/29] usbnet: make sure no NULL pointer is passed
 through

Hi!

> From: Oliver Neukum <oneukum@...e.com>
> 
> commit 6c22fce07c97f765af1808ec3be007847e0b47d1 upstream.
> 
> Coverity reports:
> 
> ** CID 751368:  Null pointer dereferences  (FORWARD_NULL)
> /drivers/net/usb/usbnet.c: 1925 in __usbnet_read_cmd()
> 
> ________________________________________________________________________________________________________

There's something wrong here. Changelog is cut, so signed-offs are
missing. It is wrong in git, too.

There's something wrong with the whitespace in the patch (indentation
by 4 spaces instead of tab), too.

Best regards,
								Pavel
								
> --- a/drivers/net/usb/usbnet.c
> +++ b/drivers/net/usb/usbnet.c
> @@ -1960,8 +1960,13 @@ static int __usbnet_read_cmd(struct usbn
>  	err = usb_control_msg(dev->udev, usb_rcvctrlpipe(dev->udev, 0),
>  			      cmd, reqtype, value, index, buf, size,
>  			      USB_CTRL_GET_TIMEOUT);
> -	if (err > 0 && err <= size)
> -		memcpy(data, buf, err);
> +	if (err > 0 && err <= size) {
> +        if (data)
> +            memcpy(data, buf, err);
> +        else
> +            netdev_dbg(dev->net,
> +                "Huh? Data requested but thrown away.\n");
> +    }
>  	kfree(buf);
>  out:
>  	return err;
> @@ -1982,7 +1987,13 @@ static int __usbnet_write_cmd(struct usb
>  		buf = kmemdup(data, size, GFP_KERNEL);
>  		if (!buf)
>  			goto out;
> -	}
> +	} else {
> +        if (size) {
> +            WARN_ON_ONCE(1);
> +            err = -EINVAL;
> +            goto out;
> +        }
> +    }
>  
>  	err = usb_control_msg(dev->udev, usb_sndctrlpipe(dev->udev, 0),
>  			      cmd, reqtype, value, index, buf, size,
> 

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ