From nobody Wed Jun 10 07:47:39 2026 Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) (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 9A0E52A1B2 for ; Sun, 17 May 2026 00:07:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778976476; cv=none; b=E02NoKQDLJJY/Mfs/dZ5Wu8CNjZb4Kib3DqyILTyMS33atb1CrC/e7WuKuqCyZNChJuYm7y8tDuxwyA6SFm3FJaMyBRNviZPLuYwtffc3CkDAsc1tg6pQYkBd8MTDTal83ZoMWHUYA5teFUwV2RbrjsNhkDxbmGRzrlxjU6g5Gs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778976476; c=relaxed/simple; bh=1BR63d47i7cdsymnhn5OIoWKov5bjNDKQfK0lCma0dA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ol1tiELyIs0UQdchlGscja3f1yRXK8juaZdxpx7yGbv1Pt89AefjRarK2iD/cyFFvzLy4kE7JT8DDpDtF44DAgzHig8eGL70yZKiwbjJidbXXrCWETR3FdWbQnGEDYrxPepWWdlLJ4rD7iAFwhvLwgkLtOdSG1cPF2YaIPlPLtk= 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=bI3/Qbw3; arc=none smtp.client-ip=209.85.219.42 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="bI3/Qbw3" Received: by mail-qv1-f42.google.com with SMTP id 6a1803df08f44-8b7ec7bedcbso4438866d6.2 for ; Sat, 16 May 2026 17:07:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778976474; x=1779581274; 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=tkDqfwt7wagaShm5M0ZiyWARHO0FrYIjrcW6gEBFvoA=; b=bI3/Qbw3W/rhYlW523TRGcc8owrV7AbTTpiCyiUuUgNVyG6ApdSpacxETFJznWKCZ/ vjyFqD8FZx106bWkditvdfnbS7TUMKUDHRY9f2JcG0wSm3t8pdfWCQyhccZOuvrA8Kf4 1aSUaSsnaWEe23Ijd/DhQ3l7TlZB4WeAoXibCbPIwVOKHjqrepifb/mlffXK1tZUf364 Q11V6OIjUcsxG9D7V/khPLKg0eXnOUBGsYzyOYbttjskdPqwcZ9i9RIrEKIEhjj6hTyJ 5kBEwb5uhRfBXlG+OJ7X9alIzYQtqDNYTMpMXViw9LWEsTnAF51RS+9t4inUxIm7rBx4 aplA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778976474; x=1779581274; 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=tkDqfwt7wagaShm5M0ZiyWARHO0FrYIjrcW6gEBFvoA=; b=CEp448r/LftfjyXQ5AX8LNf6TRXm6LYniQHJZZRu1fJlwEeItYfs+MZpoM8uq+6Y9v aqHUKfN7Xz/gAEO0u02V+M3DJHS7OXSAczXl5rqlSligxHOBLLpta1u8sqJKjRWQNG8S WZTUrIy2d2ZXFTiRGrGnhq6CQ3jXwUdWCcM1gGeNl+t8+qassrKiKfGXpX4kqTOyhyuY 2EKl7e/1RiEufK5a9tR9Vh0QimJpwtNMlsQPE3WFtxaRFKgQDXsLfJIq30MP4EEky2yX KXpoT6QXv/wTNa+ryLp9BP8EQJ0HiFTAKzWlEjG2YCIPq5gD5DDoqI3IJkWaOZQ2OKgT bUMg== X-Forwarded-Encrypted: i=1; AFNElJ8dz7Vx/aY5aGOmaFRKC50wPvnyj9y1Cmtz9KzYifSUwyD3/cgS0NhoS/LSuHeT8aBlPaymk54Z2jeWFxo=@vger.kernel.org X-Gm-Message-State: AOJu0YyHMTgR1A9eOLVnI5tylPXxYVNunUwSoUyqfWjLX5llMockEdzZ Gr3cDCjyJ1Uzw56enkesti8ndaggU0ywRYO2eLQ5dlILI8ANUAicUk7s X-Gm-Gg: Acq92OH4JXlUSOP3AnFCR/1Sf68k38Po2pn9Zjrk2X/YX1inooXnTHxwYYHH20XhdG6 0DSwcqoCxEw2B4OXL9RJv+XZzY5wtxbnOUSWWKIMNWv4nbdEVYSvqnj8PGhjyLkXA7bDrZCwhdb 6GnNWjg+f/C77zSP4Hhz8Z0GmqboUx8ASdNm/V3nPui3IbMTESIT+C2t+Gji1s4oYogmfq8b1xB JDzqlNLd5kOpluFW0j4xAMMbAvuDJ+qj/kBSI9P7Qxuz3QXF4aO1XpWZhLQOqsoEtnyHq7Ustpc CuPT1WYFF/jcdgMSXBQi9FT98O/Ph8wg4Zz1obuDHLaT4+p21qMhHDilXaOonkvthQIUUY2cQtB lUf8WfuzBeBo1Vj1D8gM2NjyWpPTPInwyhNkY2K3JDRQfpy0JRA7QK6FsvCB1jRPtciidV3ePeJ bJiHlZh1X3dOsjEDIwUKrrvs7WJrm9BXkBA+vDBgvANHLfe1phNR4Tbb1hWp1z X-Received: by 2002:a05:6214:5a09:b0:8be:6e51:37c2 with SMTP id 6a1803df08f44-8ca0f688222mr192687986d6.41.1778976474522; Sat, 16 May 2026 17:07:54 -0700 (PDT) Received: from mango-teamkim.. ([129.170.196.23]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8ca3609784bsm3474226d6.16.2026.05.16.17.07.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 May 2026 17:07:54 -0700 (PDT) From: pip-izony To: Greg Kroah-Hartman Cc: Seungjin Bae , Kyungtae Kim , Kees Cook , Dan Carpenter , David Mosberger , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] usb: host: max3421: Fix shift-out-of-bounds in max3421_hub_control() Date: Sat, 16 May 2026 20:07:31 -0400 Message-ID: <20260517000731.1869133-2-eeodqql09@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260517000145.1868817-2-eeodqql09@gmail.com> References: <20260517000145.1868817-2-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: quoted-printable Content-Type: text/plain; charset="utf-8" From: Seungjin Bae The `max3421_hub_control()` function handles USB hub class requests to the virtual root hub. In the `default` branches of both the `ClearPortFeature` and `SetPortFeature` switch statements, it modifies `max3421_hcd->port_status` by left shifting 1 by the request's `value` parameter. However, it does not validate whether this shift will exceed the width of `port_status`. So if a malicious userspace task with access to the root hub via /dev/bus/usb/.../001 issues a USBDEVFS_CONTROL ioctl with `wValue` greater than or equal to 32, the left shift operation invokes shift-out-of-bounds undefined behavior. This results in arbitrary bit corruption of `port_status`, including the normally-immutable change bits, which can bypass internal state checks and confuse the hub status. Fix this by rejecting requests whose `value` exceeds the shift width before performing the shift. Fixes: 2d53139f3162 ("Add support for using a MAX3421E chip as a host drive= r.") Signed-off-by: Seungjin Bae --- v1 -> v2: Restored a paragraph in the commit message that was truncated. 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 0e17c988d36a..3d6b351dcb1a 100644 --- a/drivers/usb/host/max3421-hcd.c +++ b/drivers/usb/host/max3421-hcd.c @@ -1694,6 +1694,8 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req= , u16 value, u16 index, !pdata->vbus_active_level); fallthrough; default: + if (value >=3D 32) + goto error; max3421_hcd->port_status &=3D ~(1 << value); } break; @@ -1747,6 +1749,8 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req= , u16 value, u16 index, max3421_reset_port(hcd); fallthrough; default: + if (value >=3D 32) + goto error; if ((max3421_hcd->port_status & USB_PORT_STAT_POWER) !=3D 0) max3421_hcd->port_status |=3D (1 << value); --=20 2.43.0