Linux USB
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Zhang Shurong <zhang_shurong@foxmail.com>
Cc: gregkh@linuxfoundation.org, 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:48:05 +0200	[thread overview]
Message-ID: <1c8ff405-2bfe-37ff-42ba-aa4f81853475@suse.com> (raw)
In-Reply-To: <tencent_15DD79B42AD8A0D64A7CDC24D4FE6C85800A@qq.com>

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.

Jan

  reply	other threads:[~2023-06-26  5:48 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 [this message]
2023-06-26  5:52   ` Greg KH
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=1c8ff405-2bfe-37ff-42ba-aa4f81853475@suse.com \
    --to=jbeulich@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --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