From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 223D12F3C0E for ; Sun, 17 May 2026 19:03:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779044639; cv=none; b=uOuxpbSLixWAhL8Rnpny509PZl45R+hr/mhlxeh6ZZ8zwLjuUtYDgZZo9ypwpS+dLmJxwzai7WlwlYD8PZ5/nQR6GE8XtIHLKZWdGlVCetAvPn/O/g0dPcTg3113LjTwj50rk4A6sVVffYUOC7naT4MOACpjOkdTioLuEvMJMPA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779044639; c=relaxed/simple; bh=RsGiYPhzHUvX/wiDftLIoes6CeFK985lMua0I8GvI18=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k2O08Kqsmq7/V9MqW1Z9mRxQob8jWZrUYrzoclz+H6DbNu02ww/pc+6Glm4j+krgtsfp53Qar+HN1rwLNbYm27QwyCt31j3WGjac3vIMEI7I6VYIvRvUOseo0qo2rZgMeOgPOKzVCbXyrDQDYziDWRykNr8ez0qAg4POAxgPdPQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=r9zhI8rS; arc=none smtp.client-ip=209.85.219.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="r9zhI8rS" Received: by mail-qv1-f51.google.com with SMTP id 6a1803df08f44-8bb4e8a5240so24675996d6.1 for ; Sun, 17 May 2026 12:03:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779044637; x=1779649437; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/3+4hEFwMySiettho6mwubbSIEJWv42YwhXdMezuDCw=; b=r9zhI8rS8RQM55Gobx2VOqAHHPZKs/sCrebD8V9moTpPvAAE/ydhcV/HTy3u7CbQlr ofjuHcgtmqRtTcjoR1Cmi5EyjZkgOhYbS+fqI3/rU/aXcrP1vRlPireyS92eL0pOHNRK uYkONdNXPk43l/JW/L0KIKt1uWqCEDIvkhZ9brQT4hWKgvyT1gT2BZG+b4Xt+PiwHM7r IHH/zQVtoFItm1bhVEN+5t4hPmEvvoADQGxpT88e/NyhF7Evjrg3VnK0JHZJa76qMB7U zVMDdgsunPgsd15BNBcSB1Zm02V9MfNpIvkhKKhFq11iRfLPhIMdO8/Qmtyal5irWoWH xMwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779044637; x=1779649437; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=/3+4hEFwMySiettho6mwubbSIEJWv42YwhXdMezuDCw=; b=e6s0DGRnl3cYD0N2wXv4qkHnj0cQ4jIJlXLAOoFXT9q/bPBPcKZEMCysvl0GXhxLat 5COBbnsN8nH78mIEmC7WxxzkkmDXB8o0ltEnfbpJ3c9lfKozrMmZKeQ0fwGBfwHyvolY j9V/M3x22STwLa8fhY2Qqp+rFqxJFcSskaQUZnrHaQWG2QcoxAeSRO4vuG75gQPetTM5 RnkDG/8LJMHoxMS2xZlEsFzFXtkWjcIqU0V+6LjTaYVuV5aVkJSOZWCZ6Htj5x9+Tmyo hyzNDkgPKscPRX90ZAd4sGFkfGQlm9hA3PA9W30hbPWndDPx10j5ArGnqTa0mfnX4uEk f6iw== X-Forwarded-Encrypted: i=1; AFNElJ9PajZedEux5yV2OPVqfIe7CjdGFau8MYY1iVKztj6hoMiRlFRFh9k0utZGd7XxPloaq3QEvY4TYP4KuH4=@vger.kernel.org X-Gm-Message-State: AOJu0YyQzbEQjqR19CnX5+Y8i2VQ+DPRo3tnWNlv2yMu3VD/3f5Gi3M9 1V/UJpR86bWClmotZENVU7uQFp80JuhVivqsRYGEj+kElVB50EG04nZe X-Gm-Gg: Acq92OHY6uFJRoGMagqbk+GDiI3UoLitPO3dvZLIbvxRhjiN1GBciEQzBp8CSBbmzkL epDjMna3VmCfVlQN9Nyzz0HK5LPv7pYsVswIgwYWtYGHYFjOaDo5VA6DB5KgW2WL3xQj9rJ4/uv 7sCMRKiNyr9g76DqyzXg7RObU4CqjkfQC1Gz+3dAQks4wPwx820gPsqCHqMOIYMRzCbNAAV+55w 73sQ17WXXHP+hL1OTkUbWwaHY73lfP8Hc/b1fxA91COdPMFqk3yl0h3jB1lo16p26b6GCwPQ0oo vZsEHPZaHl4PmUOgeXjyhiOkJDll00zBM0bfxkTNIBEHf5hTJPdWYNBV1CXNc8Jjw6XXTnaODFj VnkrKZea4hDHNIn/5/uAo6BgTi2u5c7UFNAnewnV7ayZew5oddbjxyjOBvov+73Bw1ii5Zq3qI5 GHKTATUtq/OKbb2jKUcNWn7zzjcfeN7w7IcI2UyJ9qV3ERh762Pgvt3haU6gHYV3DgrHdngNY= X-Received: by 2002:a05:6214:5544:b0:8ca:23b1:f4a9 with SMTP id 6a1803df08f44-8ca23b1f923mr126212316d6.2.1779044637136; Sun, 17 May 2026 12:03:57 -0700 (PDT) Received: from mango-teamkim.. ([129.170.196.20]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8ca361b8b10sm30473686d6.46.2026.05.17.12.03.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2026 12:03:55 -0700 (PDT) From: pip-izony To: Greg Kroah-Hartman Cc: Seungjin Bae , Kyungtae Kim , Alan Stern , Kees Cook , Dan Carpenter , David Mosberger , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/2] usb: host: max3421: Reject hub port requests for non-existent ports Date: Sun, 17 May 2026 15:03:08 -0400 Message-ID: <20260517190308.1876316-2-eeodqql09@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260517190308.1876316-1-eeodqql09@gmail.com> References: <20260517000145.1868817-2-eeodqql09@gmail.com> <20260517190308.1876316-1-eeodqql09@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Seungjin Bae 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 Signed-off-by: Seungjin Bae --- 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