From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6245835C69D; Tue, 21 Jul 2026 21:27:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784669254; cv=none; b=RFCNEH6XKOjA0ERaF7LB5lN2+0pJyrPm699GAO3x9DPXHNZV8WGLMOrchlLF1HVvsfZ9Oa0UwLDOUVafS+gfIfMu3G+1YvB254TAlZssNLWbH0LETF9N1RJRmUml3RzfJmw4A0ZB8XBGcWsy+k0dGvl+110BwUFTuVN9g2qrhMs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784669254; c=relaxed/simple; bh=UbaiDCbSy1ZzVRgSE4wOlzrUyxK5qEmmphQ5/rak2ik=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mtakz8bmOOzSYBAZMs5jS8YmPzSt6ZUzUicuX9Q4dRNTNxe04UOI9rtJLlcHkylrBN6JrmWKm7FyzU/rl5FoqLbx+BXBzDYl2bay8PaXcm25iI4uoQ6FnzxdOEG7Ce2xccUMd4gDtRhJNZTIMaxYIeoDW+5zNhx9djFNW7vScOs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=QX5pH7HX; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="QX5pH7HX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C745E1F000E9; Tue, 21 Jul 2026 21:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784669253; bh=jqNEhOjG5UzIwGGbskVKcsdtMIJhKvPzzstmYWGHFsE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QX5pH7HXbUGS4OxFDwGutwH/S2jABEjho1jj3gNUYroHLV8Q3DekgsJ91+nIpBUBm UoqvnTtPXwFDCTfpgM898wVW+QlnghfylwdU/E9t7RiZb4oVKXOgUNOnSk/g1jFmCN 3qsJ4wGrdDBOiBVtYJUveoA6j9o2R93n/uX+ixTc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Seungjin Bae , Sasha Levin Subject: [PATCH 6.1 0486/1067] usb: host: max3421: Fix shift-out-of-bounds in max3421_hub_control() Date: Tue, 21 Jul 2026 17:18:07 +0200 Message-ID: <20260721152435.487156770@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152424.521567757@linuxfoundation.org> References: <20260721152424.521567757@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Seungjin Bae [ Upstream commit cff06b03b530ae1fe8a13e93a7848f2130e00fb4 ] 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. This issue was found using a KLEE-based symbolic execution tool for kernel drivers that I'm currently developing. Fixes: 2d53139f3162 ("Add support for using a MAX3421E chip as a host driver.") Signed-off-by: Seungjin Bae Link: https://patch.msgid.link/20260518224901.1887013-1-eeodqql09@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- 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 f170741206e1df..7f948ec94305ef 100644 --- a/drivers/usb/host/max3421-hcd.c +++ b/drivers/usb/host/max3421-hcd.c @@ -1703,6 +1703,8 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req, u16 value, u16 index, !pdata->vbus_active_level); fallthrough; default: + if (value >= 32) + goto error; max3421_hcd->port_status &= ~(1 << value); } break; @@ -1756,6 +1758,8 @@ max3421_hub_control(struct usb_hcd *hcd, u16 type_req, u16 value, u16 index, max3421_reset_port(hcd); fallthrough; default: + if (value >= 32) + goto error; if ((max3421_hcd->port_status & USB_PORT_STAT_POWER) != 0) max3421_hcd->port_status |= (1 << value); -- 2.53.0