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=1796384051; b=oZqgCAQ+84mXeUdeb2BHf0DcntLnhdcLantKPYCxnidtP6EdBCnKOZMaXf16RYjrZjsn dlFKrhBRW6WX50LIR1WazJIR260BZDMHdBvF5O//t/mmuonqdBncxKmOV4MZhE0ZoHys2 LYCPYU8lneT9CvMmzrm5dCdgcopicDjJRodG3dphahoUMDO8cyWdOM4xtoVwFkkK1AYHc edJ2X+rkKE0yRl+D33090rtgpuMcNiNO3t4RKXRsYka+69x7IbBUPnPoMNIBHg11/Pnb0 DyQ+EHDwqHUitcxucIBjBdrbHusyygSpph/eVy3Ut4zhRwWxgYtOXgcshDt6HKcG4AQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384051; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=9gcXqmzpnahEu/Yk3v+TUBWarJeFWcurQtJPlyCPt/w=; b=IgXpnzEF6pkU0AR+Fnfd0T2P/djHmXea1LR90DVRSwLllgl5G+hTsO4WWgbZhzvBzYjr GrZZCW6povXXqxMw0AJiGOpg1PE9G3U/xn5wQGeUYtzCra/RTWTY+mSUIGdHxoS+EvIXC BhbFMG+u1pjq9pEtuTkygpgg2kQahCb0a9l6HAs/sxL0nY5Bcp04u7d/R5+6ldvfrkLiN kUx1I0H7RgLX0gnRKQMFrfKP6EI5gokcaj1T5Sb9LIw5/o7Yu4H1/uV8s8Z3gGLOpTR19 NO/3roDNXyAhQPYJxHY7foa+F+ZXxCuo+GCI3kA+JfLGSQREplBuUcNdB0jlU0mZRAQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=WJ6MVJ1o; 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 2C363606A32C; Fri, 4 Dec 2026 11:34:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=WJ6MVJ1o Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AD751F000C2; Fri, 4 Dec 2026 11:34:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384051; bh=9gcXqmzpnahEu/Yk3v+TUBWarJeFWcurQtJPlyCPt/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=WJ6MVJ1o6KXcYTvflCeAyFcPC5jhWEpufLh9dTGBi3TGvSMvG3UrjBpYsZlXMZd1S YQLHKDSveUegzjBSpcRmbb43x6AW6WTXpphqWlnBKmtX+Tk5GnXu6W/B/eZIwvptpr HmuOGV7a+d8EW5/bpOun/GsyclnGonjwF9J+8iOU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Joas Antonio dos Santos , Andrew Lunn , Jakub Kicinski Subject: [PATCH 6.12 475/555] net: usb: smsc75xx: reject frames without a full header and FCS Date: Fri, 4 Dec 2026 19:08:38 +0900 Message-ID: <20261204100627.328560843@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Joas Antonio dos Santos commit 1b02f90976d4bdf8c67d19dadf31b4bba05eb66f upstream. smsc75xx_rx_fixup() takes the frame length from the RX command word supplied by the device and strips the FCS by using "size - 4" for the allocation, skb_put() and memcpy() of each frame that is not the last one in the URB. The length is only checked against an upper bound and against skb->len, so a device can report a length field of 2..5, which gives a size of 0..3 after RXW_PADDING is subtracted. size is a u32, so "size - 4" then wraps to 0xfffffffc..0xffffffff. __netdev_alloc_skb() adds NET_SKB_PAD to the unsigned length, which wraps back to a small value and the allocation succeeds. skb_put() adds the length to the 32-bit skb->tail and skb->len, which also wrap, so the skb_over_panic() check does not fire. The following memcpy() then tries to copy almost 4 GiB from the URB buffer into that small allocation and writes far beyond it. A malicious or malfunctioning USB device can use this to corrupt kernel memory or crash the machine. A frame that holds an FCS but less than an Ethernet header is not valid either. usbnet drops it when it is the last frame in the URB, but the other frames go straight to usbnet_skb_return(), where eth_type_trans() reads an Ethernet header that was never copied into the new skb. Reject frames that are too short to hold an Ethernet header and an FCS, which covers both cases with one check. The driver does not set FLAG_RX_ASSEMBLE, so usbnet already counts rx_errors when smsc75xx_rx_fixup() returns 0. Also count rx_length_errors for these frames, as usbnet does for the short frames it drops itself. Found by LLM-assisted source review. Fixes: 1b3b2d9e772b ("net: usb: smsc75xx: stop lying about skb->truesize") Cc: stable@vger.kernel.org Signed-off-by: Joas Antonio dos Santos Reviewed-by: Andrew Lunn Link: https://patch.msgid.link/20261112-smsc75xx-rx-fcs-v3-1-6ad0378d0384@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- drivers/net/usb/smsc75xx.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/net/usb/smsc75xx.c +++ b/drivers/net/usb/smsc75xx.c @@ -2223,6 +2223,14 @@ static int smsc75xx_rx_fixup(struct usbn return 0; } + if (unlikely(size < ETH_HLEN + ETH_FCS_LEN)) { + netif_dbg(dev, rx_err, dev->net, + "size err rx_cmd_a=0x%08x\n", + rx_cmd_a); + dev->net->stats.rx_length_errors++; + return 0; + } + /* last frame in this batch */ if (skb->len == size) { smsc75xx_rx_csum_offload(dev, skb, rx_cmd_a,