[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2023062628-shame-ebook-56f2@gregkh>
Date: Mon, 26 Jun 2023 07:52:02 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Jan Beulich <jbeulich@...e.com>,
Zhang Shurong <zhang_shurong@...mail.com>
Cc: xen-devel@...ts.xenproject.org, linux-usb@...r.kernel.org,
linux-kernel@...r.kernel.org, jgross@...e.com
Subject: Re: [PATCH] xen: fix potential shift out-of-bounds in
xenhcd_hub_control()
On Mon, Jun 26, 2023 at 07:48:05AM +0200, Jan Beulich wrote:
> On 25.06.2023 18:42, Zhang Shurong wrote:
> > --- a/drivers/usb/host/xen-hcd.c
> > +++ b/drivers/usb/host/xen-hcd.c
> > @@ -456,6 +456,8 @@ static int xenhcd_hub_control(struct usb_hcd *hcd, __u16 typeReq, __u16 wValue,
> > info->ports[wIndex - 1].c_connection = false;
> > fallthrough;
> > default:
> > + if (wValue >= 32)
> > + goto error;
> > info->ports[wIndex - 1].status &= ~(1 << wValue);
>
> Even 31 is out of bounds (as in: UB) as long as it's 1 here rather
> than 1u.
Why isn't the caller fixed so this type of value could never be passed
to the hub_control callback?
thanks,
greg k-h
Powered by blists - more mailing lists