Linux USB
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: pip-izony <eeodqql09@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kyungtae Kim <Kyungtae.Kim@dartmouth.edu>,
	Kees Cook <kees@kernel.org>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	David Mosberger <davidm@egauge.net>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] usb: host: max3421: Reject hub port requests for non-existent ports
Date: Mon, 18 May 2026 17:54:23 -0400	[thread overview]
Message-ID: <a5b4720d-e91b-4a81-b2b6-e04835e1826b@rowland.harvard.edu> (raw)
In-Reply-To: <20260517190308.1876316-2-eeodqql09@gmail.com>

On Sun, May 17, 2026 at 03:03:08PM -0400, pip-izony wrote:
> From: Seungjin Bae <eeodqql09@gmail.com>
> 
> The `max3421_hub_control()` function handles USB hub class requests
> to the virtual root hub. The `GetPortStatus` case correctly rejects
> requests with `index != 1`, since the virtual root hub has only a
> single port. However, the `ClearPortFeature` and `SetPortFeature`
> cases lack the same check.
> 
> Fix this by extending the `index != 1` rejection to both cases,
> matching the existing behavior of `GetPortStatus`.
> 
> Fixes: 2d53139f3162 ("Add support for using a MAX3421E chip as a host driver.")
> Suggested-by: Alan Stern <stern@rowland.harvard.edu>
> Signed-off-by: Seungjin Bae <eeodqql09@gmail.com>
> ---

Reviewed-by: Alan Stern <stern@rowland.harvard.edu>

Heh, this made me go back and look at dummy-hcd.c.  It's missing the 
same check in the same places!

Would you like to submit a patch to fix that driver as well?  If not, 
I'll take care of it.

Alan Stern

>  v3: New patch in v3, suggested by Alan Stern.
> 
>  drivers/usb/host/max3421-hcd.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/host/max3421-hcd.c b/drivers/usb/host/max3421-hcd.c
> index 3d6b351dcb1a..73e76d0e6973 100644
> --- a/drivers/usb/host/max3421-hcd.c
> +++ b/drivers/usb/host/max3421-hcd.c
> @@ -1685,6 +1685,8 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req, u16 value, u16 index,
>  	case ClearHubFeature:
>  		break;
>  	case ClearPortFeature:
> +		if (index != 1)
> +			goto error;
>  		switch (value) {
>  		case USB_PORT_FEAT_SUSPEND:
>  			break;
> @@ -1728,6 +1730,8 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req, u16 value, u16 index,
>  		break;
>  
>  	case SetPortFeature:
> +		if (index != 1)
> +			goto error;
>  		switch (value) {
>  		case USB_PORT_FEAT_LINK_STATE:
>  		case USB_PORT_FEAT_U1_TIMEOUT:
> -- 
> 2.43.0
> 

  reply	other threads:[~2026-05-18 21:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-17  0:01 [PATCH] usb: host: max3421: Fix shift-out-of-bounds in max3421_hub_control() pip-izony
2026-05-17  0:07 ` [PATCH v2] " pip-izony
2026-05-17  1:15   ` Alan Stern
2026-05-17 18:11     ` Seungjin Bae
2026-05-17  5:49 ` [PATCH] " Greg Kroah-Hartman
2026-05-17 18:19   ` Seungjin Bae
2026-05-18  5:19     ` Greg Kroah-Hartman
2026-05-17 19:03 ` [PATCH v3 1/2] " pip-izony
2026-05-17 19:03   ` [PATCH v3 2/2] usb: host: max3421: Reject hub port requests for non-existent ports pip-izony
2026-05-18 21:54     ` Alan Stern [this message]
2026-05-18 22:37       ` Seungjin Bae
2026-05-18 22:49   ` [PATCH v4 1/2] usb: host: max3421: Fix shift-out-of-bounds in max3421_hub_control() pip-izony
2026-05-18 22:49     ` [PATCH v4 2/2] usb: host: max3421: Reject hub port requests for non-existent ports pip-izony

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=a5b4720d-e91b-4a81-b2b6-e04835e1826b@rowland.harvard.edu \
    --to=stern@rowland.harvard.edu \
    --cc=Kyungtae.Kim@dartmouth.edu \
    --cc=dan.carpenter@linaro.org \
    --cc=davidm@egauge.net \
    --cc=eeodqql09@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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