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: <b29ae3f8-c00d-d36d-cdd0-b7a5ccf4cab9@gmail.com>
Date:   Fri, 6 May 2022 15:13:23 +0300
From:   Pavel Skripkin <paskripkin@...il.com>
To:     Wang Cheng <wanngchenng@...il.com>, dan.carpenter@...cle.com
Cc:     linux-staging@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 3/3] staging: rtl8712: add error handler in
 r8712_usbctrl_vendorreq()

Hi Wang,

On 5/6/22 15:01, Wang Cheng wrote:
> When 'status' returned from usb_control_msg() is not equal to 'len',
> that usb_control_msg() is on partial failure, r8712_usbctrl_vendorreq()
> will treat partial reads as success.
> 
> Signed-off-by: Wang Cheng <wanngchenng@...il.com>
> ---
>   drivers/staging/rtl8712/usb_ops_linux.c | 21 ++++++++++++++-------
>   1 file changed, 14 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/staging/rtl8712/usb_ops_linux.c b/drivers/staging/rtl8712/usb_ops_linux.c
> index f984a5ab2c6f..b2181e1e2d38 100644
> --- a/drivers/staging/rtl8712/usb_ops_linux.c
> +++ b/drivers/staging/rtl8712/usb_ops_linux.c
> @@ -495,14 +495,21 @@ int r8712_usbctrl_vendorreq(struct intf_priv *pintfpriv, u8 request, u16 value,
>   	}
>   	status = usb_control_msg(udev, pipe, request, reqtype, value, index,
>   				 pIo_buf, len, 500);
> -	if (status > 0) {  /* Success this control transfer. */
> -		if (requesttype == 0x01) {
> -			/* For Control read transfer, we have to copy the read
> -			 * data from pIo_buf to pdata.
> -			 */
> -			memcpy(pdata, pIo_buf,  status);
> -		}
> +	if (status < 0)
> +		goto free;
> +	if (status != len) {
> +		status = -EREMOTEIO;
> +		goto free;
> +	}
> +	/* Success this control transfer. */
> +	if (requesttype == 0x01) {
> +		/* For Control read transfer, we have to copy the read
> +		 * data from pIo_buf to pdata.
> +		 */
> +		memcpy(pdata, pIo_buf, status);
>   	}
> +
> +free:
>   	kfree(palloc_buf);
>   	return status;
>   }

Ah, here it is. This patch should be 1st in the series, since 1/3 now 
looks buggy.




With regards,
Pavel Skripkin

Download attachment "OpenPGP_signature" of type "application/pgp-signature" (841 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ