From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795959840; b=lCWYeusKnUn4oj+QgwFLpx0a+Yb/0IIjXSemHUa8eIXjGmYpzQywLQd+D1vngqJHldWK RL4Rmm233e2mGW45nQgWtmIlDZFRPmYw9AoDuSRsGrhlrrLo+w93RRwQogFEUsuwq47rf A6M0n5AP8zY4kCHnpW2uHraDqFIm7Wj3oMF7D3ew0yUcdFwmDVjWilKQlthN0Ybsf9XDD sKDlVOtRLVFSW8TcW06h/coZm47n2LHfr5hHHbtuxggkZZD3tXqIliHVXZ4Voe82JQZDW 7ACazumZh3P1ChB1Hm/SghQ6FgCHn5QQ6JJyTSpFwSA+ErfS16zBkS2DLbjRc4XK8cA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795959840; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=0iX7143fgZsgk4pV8l8MHipF4tfqnmUNnXQfZWH5shE=; b=TUuRkvyZp+qWkAkARw3nFqtnUIICfGqImMTEHDLV3veTXOnqDIvslQfZ3WTGS9rGqn7B kzENhXVQZJ/DyTZJSxeg0dUpbUSBOeaOfMG3DXc3Q/s4HgxNg1gV1e/WYE1OucF2eKgy+ V+MeJgO/cvVG3SARbIrQsK7aX8rsiTRyKRMVuU5X3bdo1cWSOF6y6NbgvkX8IVDOScGcj exOGvEWVRUEEuCgrN5MN7tePoA/USEoDEaZBuN/un9hYSnay9CL92rC9JTdja59DhhJer j+2yvTQcYgqKPV3g1d2WbSFDLX/S+YE8/Zt6m2v8qQvNr46C3lDAXx0Y6vrsdtcW8hw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=D3zLiktT; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F01B606A329 for ; Sun, 29 Nov 2026 13:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=D3zLiktT Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13B5B1F00919; Sun, 29 Nov 2026 13:44:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795959840; bh=0iX7143fgZsgk4pV8l8MHipF4tfqnmUNnXQfZWH5shE=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=D3zLiktTgu/RqyalOamldwHm9AM43sw5yWZYpqKkADEjpy0e8gRh9jkAVb7BB6IMI AqwAy2MoB+4+bzZQMQ8JbcJ3RKVlcF8SfutVxTWufa9tvxZpZq/740EOh9VnCoo5xZ CVK273gmmPOEULeCOEqBIA14TS88JpvocFuOxsOWkUtai1FvgU5P14ngaChRnPHbqg zpmRoWKzZv8GGMbDiZCGKzt2qWe/wjF26DXF9BiwMU+hfnDZV0ejAg0KvI62Nbb44A 4Yk4p7rPyi0UrcqtK0JU7Wr0wR2pzBm6Cpk0HEIz7sUKjPW15ZKOjk5LcG7kc8DabX T8VJuC44AU9TQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 1/2] usb: gadget: f_ncm: drop datagrams larger than the NTB Reply-To: sashiko-reviews@lists.linux.dev To: "Jaegyun Lee" Cc: linux-usb@vger.kernel.org In-Reply-To: <20261129133609.403044-1-dreams200260@gmail.com> References: <20261129133609.403044-1-dreams200260@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 29 Nov 2026 13:43:59 +0000 X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [Critical] usb: gadget: f_ncm: shared SKB corruption in ncm_wrap_ntb() [1] -- commit 948568907c84c75cecfaf30bb2740fb5aec595d7 Author: Jaegyun Lee usb: gadget: f_ncm: drop datagrams larger than the NTB This commit drops outgoing datagrams in ncm_wrap_ntb() when a single datagram is too large to fit into an empty NTB of the host-selected input size. > diff --git a/drivers/usb/gadget/function/f_ncm.c b/drivers/usb/gadget/fun= ction/f_ncm.c > index 87a217090968b..da8fe49d625a2 100644 > --- a/drivers/usb/gadget/function/f_ncm.c > +++ b/drivers/usb/gadget/function/f_ncm.c > @@ -1030,6 +1030,14 @@ static struct sk_buff *ncm_wrap_ntb(struct gether = *port, > put_unaligned_le32(crc, crc_pos); > } > =20 > + if (ALIGN(ALIGN(opts->nth_size, div) + rem + skb->len, > + ndp_align) + opts->ndp_size + 2 * dgram_idx_len > > + max_size) { > + skb->dev->stats.tx_dropped++; > + dev_kfree_skb_any(skb); > + return NULL; > + } > + > /* If the new skb is too big for the current NCM NTB then > * set the current stored skb to be sent now and clear it > * ready for new data. [Severity: Critical] This problem wasn't introduced by this patch, but when ncm->is_crc is enabled via USB_CDC_SET_CRC_MODE, can appending the CRC right above this check corrupt a shared skb or panic on insufficient tailroom [1]? drivers/usb/gadget/function/f_ncm.c:ncm_wrap_ntb() { ... if (ncm->is_crc) { uint32_t crc; __le16 *crc_pos; crc =3D ~crc32_le(~0, skb->data, skb->len); crc_pos =3D skb_put(skb, sizeof(uint32_t)); put_unaligned_le32(crc, crc_pos); } ... } The driver does not set needed_tailroom on the net_device or call skb_cow_head() / skb_unshare() before calling skb_put() on the incoming skb. Mutating a cloned or shared skb corrupts payload data for other users such as TCP retransmissions, and calling skb_put() without 4 bytes of tailroom triggers skb_over_panic(). [1] https://sashiko.dev/#/bug/linux-702bf875-b704-4d4a-b11e-f29c6932077d --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261129133609.4030= 44-1-dreams200260@gmail.com?part=3D1