From nobody Mon May 25 09:56:48 2026 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 427333AC0D0 for ; Mon, 18 May 2026 05:31:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779082303; cv=none; b=nbvhbj1JTX+KMqJ9/I6xHbtPREGIFbIX1UyzqflDEydraXSYm5xmGKh5udNgesBKbgA26VAZSxkDl78TOr+XKWsdDVtyY0InNL9Zmz7aj2gBJ0ernOQfKL5Ln9BQ0l0ZQYrbnzWvxBv0km8pUuaOZPAogt9XeIXvL5sUzfjoGac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779082303; c=relaxed/simple; bh=EVprCTB8Kh8bPUFs6AGSUyf6j4PF0yXwGYHY9k2BzlA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SxdobhhwSseqVLjZXBBCdS4TitHSq9rXR9wFNbMiT0gUEw2Jk8hsH5zLellgyzszN4NeYbCV2VuzY5dAWOW8yqoJDamsjpCPhc2EHNgAqwI6j43dNFs5+LUGRDxFRHY9yv3YLl1DP3DaK5LgvjwI07BRUKoAlP/BODTFTEhlA7M= 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=HT7ydulv; arc=none smtp.client-ip=209.85.128.52 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="HT7ydulv" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-48d102471a4so13284975e9.2 for ; Sun, 17 May 2026 22:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779082285; x=1779687085; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=19WBiTVxxkWr23n+/H1N3imVfxB1B+HxV4kPuwWDblM=; b=HT7ydulvFSvnxJwi3u4PuzOzwRmaw+Yt1K+Bi1S/8PI7zz6a5uzaehs4W+Us3wwOiP xPMtqPJW/vZrujA1u9eR5ZKSw0dsrn15/XgtYL8Pwv/w2c3JDMkHVHPN1LbzoMYKhR1Q 1DgV7JcYMebPg1BKYjDXsF9WY3Yd4vgZ5M0HDck9fWYEiQ7H9macDEohVvBW3LnmOl9m bLEgmIWqugAiHnWwOJiY8d/rXX7h2q1WvZxnZOx0DpZmRjQk+zp+F4adqtk6Ukiurz9Y AWTklxh3VBVe65XdlpbfH06vF2xTH/Xc5Ku8gXQvUieLbpuvTk7Vlh7k2L0JyOHZmoNM QYjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779082285; x=1779687085; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=19WBiTVxxkWr23n+/H1N3imVfxB1B+HxV4kPuwWDblM=; b=sM/L5FKCENtaeGbRWsU58j+9zCLODgS4p3DB2bjQJETkPEoK5PfPcgZHrZ/PMERHQZ LkhdvGucKm9tL1RbPiauKYY4OZBqzT/9ESd3R45fXPUWwsE1yX78BbdBbMTIl+oZezYw d4xy1Cqzew87E2VL43IH5mrg8AcTaRonux0I1n9K4i3eKD0SWCRJxv9OYbFoJ+2sI2Xd n5WH9A9ZabWIGqmotG8fIkN/S+XSWLTOWVwgfbRBn0f5d8fd1ZSYlbCZBPUUVI1cCiLF N2Zxj9X2IcP/YVCMnVsUDiMs829RODTUkLllh3SeucJ5jg3X+KGhKqZT0U9A0jwSMl4W Clng== X-Forwarded-Encrypted: i=1; AFNElJ/toZSx1QeSde+XUusED0n+p4JvlTttGi5e8RcK1In21IFVHCImFYTrOIYNhtELZjDo7k53B7QfZi5xZc4=@vger.kernel.org X-Gm-Message-State: AOJu0YzJX6iWXt2ER79d82hCuNFDCtV4eP3xAVX8DtTme2orSS0mnTLk VFxdppYFtUl+yldRY71DNlfJNTo3NmPjlv6OhTjah8mjdxHdWlspvdDp X-Gm-Gg: Acq92OEujW1hX7JjCYFd9LeZ5VRfdU9/mKFvEUXpKC1w89I4BSpGvsywVN6V4RnWRlj AhTtFbrI4QB2RyjEsKb1a/dquxiPnqGyeJwxz6JkUu7OZiHn/+Y4eQyJUqBXvv2qzqP8d1JRRk7 eEsBoETDXOu/64i1OqZxRbFiXfu1H0ZW0UBB6V28NAu3f+6GlITPMLvgG9U8rFkC4I6q0tPhy05 iYcEZN9QYCxu5pVrxPgN7BQwiTrIg14Tr2McHlWt3/6yQRcBAVTKVsnlUjlmzy0aV1kcbz1wfep Or5t7p6EaWJn1qExvGlP7WBKzvelvgRRI8ee+bGv4mZlOdi9S2oGkMbdigLv4U7yrzPkzl0c+8/ QePyLoJt3JTiDUO+Y6ef+8zPGWTQT4CuMnH8lqS0UAZz//oh9pag19YjANs7wKErQCRw+IqklDF 9i4N/i9DcbGF2jKch1wzDVf3BvcPxKR97FLWxTPs6LUoQ= X-Received: by 2002:a05:600c:a11c:b0:47e:e2eb:bc22 with SMTP id 5b1f17b1804b1-48fe5fd536amr151451185e9.5.1779082284739; Sun, 17 May 2026 22:31:24 -0700 (PDT) Received: from foxbook (bfk48.neoplus.adsl.tpnet.pl. [83.28.48.48]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48feaa2c96csm76033455e9.2.2026.05.17.22.31.23 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 17 May 2026 22:31:24 -0700 (PDT) Date: Mon, 18 May 2026 07:31:21 +0200 From: Michal Pecio To: Greg KH , Alan Stern , Mathias Nyman Cc: "Xuetao (kirin)" , , , Subject: [PATCH v3 1/3] usb: core: Fix SuperSpeed root hub wMaxPacketSize Message-ID: <20260518073121.7bc1da0f.michal.pecio@gmail.com> In-Reply-To: <20260518073026.5580bb79.michal.pecio@gmail.com> References: <20260518073026.5580bb79.michal.pecio@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" There is no good reason to have wBytesPerInterval < wMaxPacketSize - either one is too low or the other too high, and we may want to warn about such descriptors. Start with cleaning up our own root hubs. USB 3.2 section 10.15.1 sets wMaxPacketSize and wBytesPerInterval of SuperSpeed hub status endpoints at 2 bytes, so reduce wMaxPacketSize from its former value of 4, which was derived from USB 2.0 spec and the kernel's USB_MAXCHILDREN limit. They don't apply because USB 3.2 10.15.2.1 specifies SuperSpeed hubs to have up to 15 ports. Suggested-by: Mathias Nyman Signed-off-by: Michal Pecio --- drivers/usb/core/hcd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 89221f1ce769..b181b43a35dc 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -328,9 +328,7 @@ static const u8 ss_rh_config_descriptor[] =3D { USB_DT_ENDPOINT, /* __u8 ep_bDescriptorType; Endpoint */ 0x81, /* __u8 ep_bEndpointAddress; IN Endpoint 1 */ 0x03, /* __u8 ep_bmAttributes; Interrupt */ - /* __le16 ep_wMaxPacketSize; 1 + (MAX_ROOT_PORTS / 8) - * see hub.c:hub_configure() for details. */ - (USB_MAXCHILDREN + 1 + 7) / 8, 0x00, + 0x02, 0x00, /* __le16 ep_wMaxPacketSize; 2 bytes per USB3 10.15.1 */ 0x0c, /* __u8 ep_bInterval; (256ms -- usb 2.0 spec) */ =20 /* one SuperSpeed endpoint companion descriptor */ --=20 2.48.1 From nobody Mon May 25 09:56:48 2026 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 2393A3A63ED for ; Mon, 18 May 2026 05:32:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779082343; cv=none; b=GhWeXk0cl3Dg4KPFjG2zyngnTAS4Jn+RX7s02ztpyfN2kTdRNDLOUluyQ1LJWxJr8Oo7q2/ymoBBX8WdCzpsVvxuYyNRNSb3KyhDYmaXIs4Auy3k8Ch6bOoShTzX6ht9oDHoyV9ZkecGMc+lQ44Fw8jyOH64ZEBf4ZlMqBVpuU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779082343; c=relaxed/simple; bh=mdFHqmiM7J1eyeeB0BYJJMW3l7BJGjPJuNDC/3hHRa4=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Izv5PTRvWdjjR5GjY3AeRc2t86vvjxaFlWn0JhapwGRbP/yLfLqSZW80vUISTzKsxO9iNUh9dmBsi3F9TIb2hgs65jpHTXZivoEEUIvrrY9bfqDmResgiiYFAmDE/gbrEgOMdBtK4Vdhj5yNZC4IaJBInf3Ug9IGeUxzQf56/38= 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=NWWLlLT9; arc=none smtp.client-ip=209.85.128.49 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="NWWLlLT9" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4896c22fcbaso14152055e9.0 for ; Sun, 17 May 2026 22:32:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779082330; x=1779687130; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=zz3RXE6rLnkPyLWqz9WMXcLwC/lkGY7zfy2G8LQXM4I=; b=NWWLlLT9+6Mvp7iSmMIaz2YEsLV7HhJi/fq+nZlpYdY1U0/AerSqsI11br1hyb7/Z5 U81aCeYHts06iZeIpDCdI/IiyH3jPDeSmC6Jc3HKl+oq6wEQE7sbyLsY3+Z0WZJBxgsG 7cXXy/Z9uHFOcYLcWv2b+4opxfX0Pcurr2WqmxpvaaGeaDXGIMmtfPc2wy4uWn2rOzxh OgekfyOSEQc+1pJ38eUwbpNj9FcCzweDbzp46NUIXrWcKMVSHLf8bLc8iyK8i27xS4ue 46w1MV4ldOhaQq8typqUmU9WvxBYyX31joY4fF+Nvmf1v97xpB5w5MbtfbkqX2G65Gpf Y04A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779082330; x=1779687130; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=zz3RXE6rLnkPyLWqz9WMXcLwC/lkGY7zfy2G8LQXM4I=; b=M7WDnYuPZBpOcHiSpB3jLKyhkzw1E4TeREBOVJLBaMjmTQEe6750bln3eun/M3cLR+ wBHZJtGlQyx7QLuYexk0eBupTSjpwTUatvp2BeWyTF+RX8hR2/ze/HSLSJgxFh3Ikq8Y 5r83stLHYOQHgB98d4Cu5CeZSKTIpbpWTAUwHor6q0LyeKjZ8GfPQvRqpcOTbfpDHZfQ BJ7+gokBz0u0M1KBiSssi/l4gTCwqmRRiYM3OrH7teqX1Wps8IHfdSizvn/DH97Rd7Cn MxqOsPhhupxAOOym3G90Eu34OVkluIHvVzTni56AYRQtWiQyv4OQpMw+PY3CLmYq70zz Fdfg== X-Forwarded-Encrypted: i=1; AFNElJ893isKK0i2MzCjKigc7BLCYuXSU4I9Kt+k9UF1ShVDmVwrP0CVP7Hyb+y6K0YzcQFtBRo0b1wu6SDupRg=@vger.kernel.org X-Gm-Message-State: AOJu0Yya3gTnrFYA0uAqzaBfI4Xea0L+3dHzbjmFwGBBTZg2Aw1t1PUN PwEFC9ZOkGWtRiRar0bVQDdbRdjrqwVSan8NojA/FNkRuPpj2QrEN81p X-Gm-Gg: Acq92OFUjcWJuUNQyhBNrQbDGl3XuLpMFeh61ePz6tiwSE9lP3imW/6WvCijsLYFCG2 o/2JHkucjkQxkM9OrozRj9hS8MNHllklnG3ZXZz/5jNdroz1+E0vYlTpPch6O9sBL/aoLC+8oZX zdOlRfYiFwuoU779SF74+LYx8UkS1qf4SeQaiRrCnnSRjm53rpxFdlQPeunyq8HUWieY7bseMrn fuVr+DMr0LDXQ9juFSZjVEMWXZXtYps1Iz9EePPRrClWHskPTdfx2I52Y5nW6cYiooopfVl7RwP tF47MeyyvNm3Puyr4vFOuFd1nGLtbti8oXRlUh35ze2dLIpZqXkAvRSAxqvad1D1wDKtJ07d9LK puO+fhetaWUi/SA+XJffsQKfja14iC9dG5Cq1o5u+RYtEJqLMt2KiHmU8cyi8gJarGtnuPxLRUO qAKEV7pNOxn5FMlVzWF2UcBcnVjTmZWx7g X-Received: by 2002:a05:600c:8b6e:b0:48a:6fd4:d3d3 with SMTP id 5b1f17b1804b1-48fe61ed21amr213731975e9.20.1779082330414; Sun, 17 May 2026 22:32:10 -0700 (PDT) Received: from foxbook (bfk48.neoplus.adsl.tpnet.pl. [83.28.48.48]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48fe53ab6aasm243360535e9.2.2026.05.17.22.32.09 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 17 May 2026 22:32:10 -0700 (PDT) Date: Mon, 18 May 2026 07:32:07 +0200 From: Michal Pecio To: Greg KH , Alan Stern , Mathias Nyman Cc: "Xuetao (kirin)" , , , Subject: [PATCH v3 2/3] usb: core: Fix up Interrupt IN endpoints with bogus wBytesPerInterval Message-ID: <20260518073207.5b7d26e7.michal.pecio@gmail.com> In-Reply-To: <20260518073026.5580bb79.michal.pecio@gmail.com> References: <20260518073026.5580bb79.michal.pecio@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" Tao Xue found that some common devices violate USB 3.x section 9.6.7 by reporting wBytesPerInterval lower than the size of packets they actually send. I confirmed that AX88179 may set it to 0 and RTL8153 CDC configuration sets it to 8 but sends both 8 and 16 byte packets: S Ii:11:007:3 -115:128 16 < C Ii:11:007:3 0:128 8 =3D a1000000 01000000 S Ii:11:007:3 -115:128 16 < C Ii:11:007:3 0:128 16 =3D a12a0000 01000800 00000000 00000000 Most xHCI host controllers neglect interrupt bandwidth reservations and let such devices exceed theirs, some fail the URB with EOVERFLOW. Assume that wBytesPerInterval lower than wMaxPacketSize is bogus and increase it to the worst case maximum on interrupt IN endpoints. This solves xHCI problems and appears to have no other effect. Interrupt transfers are not limited to one interval and drivers submit URBs of class defined size without looking at wBytesPerInterval. Any multi- interval transfer is considered terminated by a packet shorter than wMaxPacketSize regardless of wBytesPerInterval - see USB3 8.10.3. Stay in spec on OUT endpoints and isochronous. No buggy devices are known and we don't want to risk sending more data than the device is prepared to handle or confusing isoc drivers regarding altsetting capacities guaranteed by the device itself. And don't complain when wMaxPacketSize <=3D wBytesPerInterval < wMaxPacketSize * (bMaxBurst+1) because enabling this seems to be the exact goal of the spec. Reported-and-tested-by: Tao Xue Closes: https://lore.kernel.org/linux-usb/20260402021400.28853-1-xuetao09@h= uawei.com/ Cc: stable@vger.kernel.org Signed-off-by: Michal Pecio --- drivers/usb/core/config.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index 417140b012bb..d9171bf7bc88 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -191,7 +191,14 @@ static void usb_parse_ss_endpoint_companion(struct dev= ice *ddev, int cfgno, (desc->bMaxBurst + 1); else max_tx =3D 999999; - if (le16_to_cpu(desc->wBytesPerInterval) > max_tx) { + /* + * wBytesPerInterval > max_tx is bogus, but USB3 spec doesn't forbid the = opposite. + * Experience shows that wBytesPerInterval < wMaxPacketSize on common int= errupt IN + * endpoints is usually bogus too, and recent HCs enforce interrupt BW li= mits. + */ + if (le16_to_cpu(desc->wBytesPerInterval) > max_tx || + (le16_to_cpu(desc->wBytesPerInterval) < usb_endpoint_maxp(&ep->desc) = && + usb_endpoint_is_int_in(&ep->desc))) { dev_notice(ddev, "%s endpoint with wBytesPerInterval of %d in " "config %d interface %d altsetting %d ep %d: " "setting to %d\n", --=20 2.48.1 From nobody Mon May 25 09:56:48 2026 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) (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 E4E5F3ACEFB for ; Mon, 18 May 2026 05:33:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779082392; cv=none; b=dOIuSKeIhQSN/eOqdpoMbXUUAAY09YR0sfpq4iza+pg0G8S/CSx9Xz+folTreiTMdJjRUDLNzof34aAOYX1tWR6FSfRsREZBTidFZFRWlhBsFFz9EcY9yp8dGYbpSnOYYPh1fX3ZurRf+Hv0daH/ssQJ7wkBiNyLxkH1di472sY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779082392; c=relaxed/simple; bh=Nh15+rjuAdNdNFUVnUCc9NVTlovRLJNB2stEoajO3O4=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gl0ELQcuved8XPixWyuEDXqy+as3bnmeNl9tTDFn9NQebIiCaRBxAsBVovOztQOQ1bPuLooUV5My7aQ8JoeMXs+bSSg4BTBbSvi0hQ9kj5hJtEa3F/NFRIHDQoChnZB20LpMdVWfhXn2kzFvUVnmMqbnN9mYYpxzLMQYFGdT3J8= 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=ndBB4n94; arc=none smtp.client-ip=209.85.221.54 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="ndBB4n94" Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-4526a8170ceso637231f8f.2 for ; Sun, 17 May 2026 22:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779082381; x=1779687181; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=HYS4lXTDitNv9r/jAYcacHGuHc1isduHlp2DzVkQuhE=; b=ndBB4n94xfNA355HZFRx3/xAHUZMXeKBgntsJ/1QpYKVNpU0q8Z7KPDHhOUkLP4teq qFt1XG9jd7ugtg/fZM5Ulzfmw++bUAbXjppV4uuvpvMxJRTnjo02ZQeMg3Z3/uIV3CYN NecmY8DCx1vhpsC4Rl2YDfCFJnXvzCUu0QWO+wH6G1dn/oJHyWn6cQqtU3vep5kYmZoP OxdH3BvWUc9GeEAKSABMdHwWdVOuo50eCMNEuzW47fSViqAX4odaVxlTU0CmlvhjjeQ1 RX3ERw/OWS5R3jJaaa33k663jHu47ilkA1MpKGYcbxPCVEIVo/ptt1UfgXyjGwDRZ5Sl 97Xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779082381; x=1779687181; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=HYS4lXTDitNv9r/jAYcacHGuHc1isduHlp2DzVkQuhE=; b=ayoyIc865CB+HwRNBXhh3RNHlIQK8x0H7i8kt5aXk5IyOzMQKXtU4usnnjMg6gicma Xbg0DLVnS86uEwTpIR4a6hFpGxtru7vuW48Q83xYIFTukuU0oARKw7E0UJcy0PZ9oMWm a8rZbPYxXda5Ir52kKH0f33dMrUvfH8yMEONM1f+9DfuPKev1fUutRduYl+ERZCgVy91 EhImuUlPbeqwXaCwrlMGqbah/B8bGgH8Ji8otcp1wZrHHjfSVEvsFc5bO2Y4xQwzR916 YfsdpDVAU6cGkA3fe0YcbhJqBGGNK1HnajXLH5Eha/OCEFdAgJYeXKPayBEa8XqhzZXK 6heA== X-Forwarded-Encrypted: i=1; AFNElJ/RFxG4Uki0/68ofbuwn16b2dkf0wmxXzqjVgx/zswROXgRRFeRQGytvS86lSUXQW+Pqcfb3gEWi+CXXpI=@vger.kernel.org X-Gm-Message-State: AOJu0Yzc15poR2/cH54S0CegVRHYh92swZYHtgD+LY4ll3ZmIQF/aiu1 qb/NnvSv3hYI7xsJZ56b0Rs5qaM+BlKG2aQgjEwIivdihVU7noaYogerMrv1Cw== X-Gm-Gg: Acq92OHJcAwywzzQMH/BHAgN2SwfScmIgsJZ95SQkry4wGfHI3O0O8JY082WJnxA2KH A0F7hnu8lxNBK9Ej/XOMqEPQ7uORRPAY5XNKb5dtTcd+N51vwW/3pd6s3SZ4tOmo9k0OML/TkCZ 0Co//7z8ocya/jiXgTCj7U6qHlsE0F1cSQa3om81ZwsJUnPtmzhKyyHsR8pNVDcPwieY75PqRjg dtzqfU+anoJ2OneFScq8q7nVFbvwRy8RhAxqbCRSL0J8AhxpFnyx4CslNDY4Rimnlna70b2uCIU FNwXNgnBf8ZKQDQgNbyWba0FNingc65o/t7s0ty7LtA3FX0LDhvYTvnNcy+6d2VFbKlhK3OQV2G gB9ymCjhlaniXHl0UXefpZnqAYbcKfIWpxvaJ5dkTeFI32+4yds4D8mEfgGgdIdNCVkl2Qq82zM koEKicy1j1Nl3Z0iXfmVIRA9uF+f/gFkls X-Received: by 2002:a5d:5889:0:b0:45e:5b92:1e45 with SMTP id ffacd0b85a97d-45e5c60d55dmr18816963f8f.40.1779082381480; Sun, 17 May 2026 22:33:01 -0700 (PDT) Received: from foxbook (bfk48.neoplus.adsl.tpnet.pl. [83.28.48.48]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45d9e767d0bsm33000275f8f.3.2026.05.17.22.33.00 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 17 May 2026 22:33:01 -0700 (PDT) Date: Mon, 18 May 2026 07:32:58 +0200 From: Michal Pecio To: Greg KH , Alan Stern , Mathias Nyman Cc: "Xuetao (kirin)" , , , Subject: [PATCH v3 3/3] usb: core: Clean up SuperSpeed/eUSB2 descriptor validation logging Message-ID: <20260518073258.6532bdd5.michal.pecio@gmail.com> In-Reply-To: <20260518073026.5580bb79.michal.pecio@gmail.com> References: <20260518073026.5580bb79.michal.pecio@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" Core usually prints endpoint addresses with 0x%X format. Change this code to use it too, instead of just %d. Particularly for IN, 0x83 seems more readable than 131. While at that, fix checkpatch warnings about multi-line quoted strings, as well as missing or doubled whitespace in those strings. Signed-off-by: Michal Pecio --- drivers/usb/core/config.c | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index d9171bf7bc88..45e20c6d76c0 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -56,8 +56,7 @@ static void usb_parse_ssp_isoc_endpoint_companion(struct = device *ddev, desc =3D (struct usb_ssp_isoc_ep_comp_descriptor *) buffer; if (size < USB_DT_SSP_ISOC_EP_COMP_SIZE || desc->bDescriptorType !=3D USB_DT_SSP_ISOC_ENDPOINT_COMP) { - dev_notice(ddev, "Invalid SuperSpeedPlus isoc endpoint companion" - "for config %d interface %d altsetting %d ep %d.\n", + dev_notice(ddev, "Invalid SuperSpeedPlus isoc endpoint companion for con= fig %d interface %d altsetting %d ep 0x%X.\n", cfgno, inum, asnum, ep->desc.bEndpointAddress); return; } @@ -91,7 +90,7 @@ static void usb_parse_eusb2_isoc_endpoint_companion(struc= t device *ddev, size -=3D h->bLength; } =20 - dev_notice(ddev, "No eUSB2 isoc ep %d companion for config %d interface %= d altsetting %d\n", + dev_notice(ddev, "No eUSB2 isoc ep 0x%X companion for config %d interface= %d altsetting %d\n", ep->desc.bEndpointAddress, cfgno, inum, asnum); } =20 @@ -115,9 +114,7 @@ static void usb_parse_ss_endpoint_companion(struct devi= ce *ddev, int cfgno, } =20 if (desc->bDescriptorType !=3D USB_DT_SS_ENDPOINT_COMP) { - dev_notice(ddev, "No SuperSpeed endpoint companion for config %d " - " interface %d altsetting %d ep %d: " - "using minimum values\n", + dev_notice(ddev, "No SuperSpeed endpoint companion for config %d interfa= ce %d altsetting %d ep 0x%X: using minimum values\n", cfgno, inum, asnum, ep->desc.bEndpointAddress); =20 /* Fill in some default values. @@ -141,42 +138,32 @@ static void usb_parse_ss_endpoint_companion(struct de= vice *ddev, int cfgno, =20 /* Check the various values */ if (usb_endpoint_xfer_control(&ep->desc) && desc->bMaxBurst !=3D 0) { - dev_notice(ddev, "Control endpoint with bMaxBurst =3D %d in " - "config %d interface %d altsetting %d ep %d: " - "setting to zero\n", desc->bMaxBurst, - cfgno, inum, asnum, ep->desc.bEndpointAddress); + dev_notice(ddev, "Control endpoint with bMaxBurst =3D %d in config %d in= terface %d altsetting %d ep 0x%X: setting to zero\n", + desc->bMaxBurst, cfgno, inum, asnum, ep->desc.bEndpointAddress); ep->ss_ep_comp.bMaxBurst =3D 0; } else if (desc->bMaxBurst > 15) { - dev_notice(ddev, "Endpoint with bMaxBurst =3D %d in " - "config %d interface %d altsetting %d ep %d: " - "setting to 15\n", desc->bMaxBurst, - cfgno, inum, asnum, ep->desc.bEndpointAddress); + dev_notice(ddev, "Endpoint with bMaxBurst =3D %d in config %d interface = %d altsetting %d ep 0x%X: setting to 15\n", + desc->bMaxBurst, cfgno, inum, asnum, ep->desc.bEndpointAddress); ep->ss_ep_comp.bMaxBurst =3D 15; } =20 if ((usb_endpoint_xfer_control(&ep->desc) || usb_endpoint_xfer_int(&ep->desc)) && desc->bmAttributes !=3D 0) { - dev_notice(ddev, "%s endpoint with bmAttributes =3D %d in " - "config %d interface %d altsetting %d ep %d: " - "setting to zero\n", + dev_notice(ddev, "%s endpoint with bmAttributes =3D %d in config %d inte= rface %d altsetting %d ep 0x%X: setting to zero\n", usb_endpoint_xfer_control(&ep->desc) ? "Control" : "Bulk", desc->bmAttributes, cfgno, inum, asnum, ep->desc.bEndpointAddress); ep->ss_ep_comp.bmAttributes =3D 0; } else if (usb_endpoint_xfer_bulk(&ep->desc) && desc->bmAttributes > 16) { - dev_notice(ddev, "Bulk endpoint with more than 65536 streams in " - "config %d interface %d altsetting %d ep %d: " - "setting to max\n", + dev_notice(ddev, "Bulk endpoint with more than 65536 streams in config %= d interface %d altsetting %d ep 0x%X: setting to max\n", cfgno, inum, asnum, ep->desc.bEndpointAddress); ep->ss_ep_comp.bmAttributes =3D 16; } else if (usb_endpoint_xfer_isoc(&ep->desc) && !USB_SS_SSP_ISOC_COMP(desc->bmAttributes) && USB_SS_MULT(desc->bmAttributes) > 3) { - dev_notice(ddev, "Isoc endpoint has Mult of %d in " - "config %d interface %d altsetting %d ep %d: " - "setting to 3\n", + dev_notice(ddev, "Isoc endpoint has Mult of %d in config %d interface %d= altsetting %d ep 0x%X: setting to 3\n", USB_SS_MULT(desc->bmAttributes), cfgno, inum, asnum, ep->desc.bEndpointAddress); ep->ss_ep_comp.bmAttributes =3D 2; @@ -199,9 +186,7 @@ static void usb_parse_ss_endpoint_companion(struct devi= ce *ddev, int cfgno, if (le16_to_cpu(desc->wBytesPerInterval) > max_tx || (le16_to_cpu(desc->wBytesPerInterval) < usb_endpoint_maxp(&ep->desc) = && usb_endpoint_is_int_in(&ep->desc))) { - dev_notice(ddev, "%s endpoint with wBytesPerInterval of %d in " - "config %d interface %d altsetting %d ep %d: " - "setting to %d\n", + dev_notice(ddev, "%s endpoint with wBytesPerInterval of %d in config %d = interface %d altsetting %d ep 0x%X: setting to %d\n", usb_endpoint_xfer_isoc(&ep->desc) ? "Isoc" : "Int", le16_to_cpu(desc->wBytesPerInterval), cfgno, inum, asnum, ep->desc.bEndpointAddress, --=20 2.48.1