Article View: linux.kernel.netdev
Article #14273Re: [PATCH net] net: usb: smsc75xx: reject frames shorter than the FCS
From: Andrew Lunn
Date: Tue, 10 Nov 2026 22:41
Date: Tue, 10 Nov 2026 22:41
29 lines
9525 bytes
9525 bytes
On Tue, Nov 10, 2026 at 09:03:21AM +0000, Joas Antonio dos Santos via B4 Relay wrote: > From: Joas Antonio dos Santos <joasantonio108@gmail.com> > > 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. > > Reject frames that are too short to hold an FCS, as lan78xx_rx() does. I assume there is soon going to be another check to ensure the frame is big enough to have an ethernet header? Can these checks be combined? Andrew
Technical Details
Message-ID:
<137b3cc5-7077-45d9-8ba3-ea4c584f1992@lunn.ch>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360705-linux-kernel-netdev=dewy.ruReferences:
<20261110-smsc75xx-rx-fcs-v1-1-4e048bfc28f3@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360705-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net] net: usb: smsc75xx: reject frames shorter than the FCS Date: Tue, 10 Nov 2026 23:41:31 +0100 Organization: Usenet Network Message-ID: <137b3cc5-7077-45d9-8ba3-ea4c584f1992@lunn.ch> References: <20261110-smsc75xx-rx-fcs-v1-1-4e048bfc28f3@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="721478"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:iWf+QwJwfLa2qsAu0NTcWLIfa68= sha256:ujlHZBzG1xWjNOUROdOj08yEG7V+bSIKZGZO3k5TVCk= sha1:r/0YvxwXXJEz35SLZuEc0r6pjLI= sha256:9pvT8wqjWn7qQe7IA7frjIa72dRrkV3brA5XC1tpWJM= Content-Disposition: inline List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 1B8EB113D95; Wed, 11 Nov 2026 01:43:40 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -1.95 X-Spam-Status: No, score=-1.95 tagged_above=-9999 required=6.31 tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=lunn.ch X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id g0LbzsELgv9I; Wed, 11 Nov 2026 01:43:32 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-360705-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id AEA24113CFC; Wed, 11 Nov 2026 01:43:22 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 4ECC63CD25; Tue, 10 Nov 2026 22:41:46 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1794350501; b=PWOvu43a68Y1kEJ8goQItNV46Utozp9IVl0FlnSsZq6TcOWXI7r4Wj9sGK+IQxwAQoUZ 7noxNFyKI8WWHT2BqQspiHGaZ2odWqet5uEyLV+CYnSS4UykdZSyw9bitkVlOY8g5Bbtb Qdi+Nkj5wWjlSIkKE2VQW0u3EGB5G8lzXA3rLoYcE6XD4SRPJ68QdAFPJ9I+Aj1KqZXV3 5Gb0OrDKLFeGu9LXUGLasVkMxkVgWihwhFpMBZowQ5842EGQTkeXTt2YA0H7z+TaClgW7 6Ef50MwrcyrPqVkAZlhv6EmCyvquniMcH3d6qYJ7bq9ZWydahRCNWlZqj8usU3hk0Aw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794350501; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date: From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=NijWXXvdHVUP6AQHOboqPYVhaLdHKiYRLTT2DOKoP9M=; b=qcpo8d0s3lBp23K/OWluDlAzP9P2S2yTgb01Suo7IgWZCFP4yaq3hzuMmIMeEl5aCvE2 rr/HhmXRaMXYSWe0Wp4kF0aFdqmsgdu+7cvf+kpaPIXAOn/o2ruBCqq3RzkKtUuty3ZLl dg/a5EW0qTRkMJM/x78+1CFAVfl/NMscwRdKZfLJKuV/EG+inLGzWff8RAoXk9WMqxWah rUfgcNBlwBlbk6ucSa5TQkhFXTEr7vtmdubBsu2aTZrBV4a2K9Wt50c1ZSPtw14CRVFv7 f/OdHJRQLi4bH0bvyg2uxLjRH2nx1Ca6xBuoTN8FkKjOtloR6fu8sSzQVCFMM0NdFmw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=T6x9htG2; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; arc=fail smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 24193606A338; Tue, 10 Nov 2026 22:41:41 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=T6x9htG2 X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794350500; b=lVd8UPX4LHdnFzCWsZntFU3lIUPfE24Y8curULulwtcbxKa5dFicdbo3YM9d3gGG47V3 7pUB8vnaEl3zlfOPekQ+Wfx/2M8Xr/6SJp0W/2J6RQz1op5uYz72r/WZmsDF4Y7vho8mL kHcOCUNkHX6XAz74nf336bE3FzCb9d8TfU+e2mNXJkygVYaK+5fShj+zzNJFrxAP3Oglk gAU4V12IOjIupl/4IiQDyG09TMdqS/8FXNGNyhTAVqmzYwuPRLsG9w0K7O2JKWjGq7xoe BbumZN8INMwa5zXH1ERn3ZaXyXePUwMQGR9UGzFUsd6lKGoFBOsJmm2ciWexJFRMfAg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794350500; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=NijWXXvdHVUP6AQHOboqPYVhaLdHKiYRLTT2DOKoP9M=; b=xbBO5hsESSK6O4dsHPEiVkYSioA+jn11aL6nfS9NXCOnH234v6YPWl2CotPPC6Cxe1iC Y73wP53BTnXTUSqQne7XMuyp9R8W6NfdXs82UB/lm/QIS2X6EUclAcn6e/isBE7IApXi9 +meNxhwqzoiDyWrAK5Kly6PfO45p5A0pUSGrEacNBvVpqCQqUQx3vyYY6thnb+aZcPBng UgX3ymQSf/S6SgBcSO8/nJPUxOeICxULVWaUIbggjew5GPbNPjkgLIPFR6+AC9rRr+cN+ 2dHKQdeCh/QQnGwJmmhPJjeXGFUyKklaMszsWiibx0yG6rrieauCf12crwazfEnv/4A== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=T6x9htG2; arc=none smtp.remote-ip=156.67.10.101 X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA6B0606A31C; Tue, 10 Nov 2026 22:41:39 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CA6B0606A31C X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=NijWXXvdHVUP6AQHOboqPYVhaLdHKiYRLTT2DOKoP9M=; b=T6x9htG2JWq3vI26F++miy+joo D3sjp0DeI/7GWaX+8eA5RzAUSTl9nuN9EX5FjvzvVdp6p/vup/wUoyEvOMelo/eq2zmyZosuGxKbA X25FIvBqu9Zf4okRNNa8GqlCugPh/kTzkgRCz6Kq/xpH9XkQnEdbZVdJ3NLTRYaYjtwg=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xQuWx-00Fb2E-5f; Tue, 10 Nov 2026 23:41:31 +0100 X-Cc: steve.glendinning@shawell.net, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-In-Reply-To: <20261110-smsc75xx-rx-fcs-v1-1-4e048bfc28f3@gmail.com>