From: Greg KH <gregkh@linuxfoundation.org>
To: Jan Beulich <jbeulich@suse.com>,
Zhang Shurong <zhang_shurong@foxmail.com>
Cc: xen-devel@lists.xenproject.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, jgross@suse.com
Subject: Re: [PATCH] xen: fix potential shift out-of-bounds in xenhcd_hub_control()
Date: Mon, 26 Jun 2023 07:52:02 +0200 [thread overview]
Message-ID: <2023062628-shame-ebook-56f2@gregkh> (raw)
In-Reply-To: <1c8ff405-2bfe-37ff-42ba-aa4f81853475@suse.com>
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
next prev parent reply other threads:[~2023-06-26 5:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-25 16:42 [PATCH] xen: fix potential shift out-of-bounds in xenhcd_hub_control() Zhang Shurong
2023-06-26 5:48 ` Jan Beulich
2023-06-26 5:52 ` Greg KH [this message]
2023-07-01 15:51 ` Zhang Shurong
[not found] ` <4825193.GXAFRqVoOG@localhost.localdomain>
2023-08-06 14:11 ` Zhang Shurong
2023-08-06 14:27 ` Greg KH
2023-08-06 15:15 ` Alan Stern
2023-08-08 8:26 ` Greg KH
2023-08-08 15:05 ` Alan Stern
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2023062628-shame-ebook-56f2@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=xen-devel@lists.xenproject.org \
--cc=zhang_shurong@foxmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox