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]
Date:   Thu, 16 Mar 2023 11:36:41 +0100
From:   Jó Ágila Bitsch <jgilab@...il.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 1/1] usb: gadget: Use correct endianness of the wLength
 field for WebUSB

On Mon, Mar 13, 2023 at 4:44 PM Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
>
> WebUSB code uses wLength directly without proper endianness conversion.
> Update it to use already prepared temporary variable w_length instead.

Excellent catch! Thank you very much for finding this. This could have
been a very hard to find issue in a big endian system.

I tested this on my local setup and it (unsurprisingly) works like a charm.

> Fixes: 93c473948c58 ("usb: gadget: add WebUSB landing page support")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Tested-By: Jó Ágila Bitsch <jgilab@...il.com>

> ---
>  drivers/usb/gadget/composite.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
> index fa7dd6cf014d..5377d873c08e 100644
> --- a/drivers/usb/gadget/composite.c
> +++ b/drivers/usb/gadget/composite.c
> @@ -2079,10 +2079,9 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
>                                 sizeof(url_descriptor->URL)
>                                 - WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH + landing_page_offset);
>
> -                       if (ctrl->wLength < WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH
> -                                           + landing_page_length)
> -                               landing_page_length = ctrl->wLength
> -                                       - WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH + landing_page_offset;
> +                       if (w_length < WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH + landing_page_length)
> +                               landing_page_length = w_length
> +                               - WEBUSB_URL_DESCRIPTOR_HEADER_LENGTH + landing_page_offset;
>
>                         memcpy(url_descriptor->URL,
>                                 cdev->landing_page + landing_page_offset,
> --
> 2.39.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ