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 CC707425863; Tue, 21 Jul 2026 19:33:42 +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=1784662423; cv=none; b=LoOjInkcMP5JaQaM/w1uIhmzC2iOttwNt8KKeCYBoSLfm59oQ3cwBsqRE4YVNSi6r+AzsPsPgEVl6cXrOqYZIyOmha431GI5RSXfHlYZWj54UI6FS4fwdQprLhW3Yo0eQhtbT8VGY24LCht8XZmH/+WGVruKFguGItSOIMdSQI8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784662423; c=relaxed/simple; bh=8aBBlTN6SBtMRSxOPCRd5bwoQOhpIWI77FEp6w64IQk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k6UdVYsc8LIrQOgNWnJT4xfhNF97Rd0jetE2AM8cbFiUNjtV2LWkqS923H/YIlMR8hlKfwkQ+Nc3Fe/pDv3bivtMbg2SIAS55WNWmSh+d6iqlK9N7HxA8DRp0sB8cHfh8db4Q+xLbxCILQ38hMk+cQikIL6JUjeFO0+DnNuDzPQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kkCSmZ2H; 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="kkCSmZ2H" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F7761F00A3A; Tue, 21 Jul 2026 19:33:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784662422; bh=oU7BzPwxwpcUg603pa1htt4I4OH+/oiKH3WbnPLQ9TE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kkCSmZ2HRqiIPaA005z3iRXiyGHFWKQ1raI6LdypNh0juKshjZjdOFaICdc+WugiA rEPLL0wmjFkeCDt5sFzo61q5b5SOYGTbM3u5bmI58owLpmOUwzmN7T2FkAzNxezSBa gJTvMu24kzHE4EEDcbJGi0ybQCOR2hL6xIsGh7Os= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Seungjin Bae , Sasha Levin Subject: [PATCH 6.12 0439/1276] usb: host: max3421: Fix shift-out-of-bounds in max3421_hub_control() Date: Tue, 21 Jul 2026 17:14:42 +0200 Message-ID: <20260721152455.926207915@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260721152446.065700225@linuxfoundation.org> References: <20260721152446.065700225@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.12-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 4b5f03f683f775..823dc61d31e86b 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 >= 32) + goto error; max3421_hcd->port_status &= ~(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 >= 32) + goto error; if ((max3421_hcd->port_status & USB_PORT_STAT_POWER) != 0) max3421_hcd->port_status |= (1 << value); -- 2.53.0