Article View: linux.kernel.netdev
Article #7569Re: [PATCH net v2 2/2] net: usb: pegasus: check rx pkt_len against the received length
From: Simon Horman
Date: Mon, 26 Oct 2026 16:31
Date: Mon, 26 Oct 2026 16:31
39 lines
9817 bytes
9817 bytes
On Wed, Oct 21, 2026 at 10:03:10AM +0800, Wei Jie Law wrote:
> read_bulk_callback() takes the frame length from the device, from the
> receive header on the 0x8513 and from the trailing status bytes on the
> other chips, and only checks it against PEGASUS_MTU before passing that
> many bytes up the stack. In two cases the stack then uses bytes that the
> device did not send:
>
> - A device that sends a short transfer but claims a long frame gets the
> stale or uninitialized remainder of the receive skb delivered as
> packet data.
>
> - A device that claims a frame shorter than an Ethernet header gets
> past the check as well. eth_type_trans() takes pkt_type from h_dest
> and the protocol from h_proto without checking skb->len. If the
> transfer is also short, those come from bytes left in the skb by an
> earlier transfer, or from uninitialized memory.
>
> Drop frames shorter than ETH_HLEN, and frames whose claimed length, plus
> the 0x8513 header, does not fit in the bytes actually received, and
> count them as length errors. urb->actual_length never exceeds the
> PEGASUS_MTU sized transfer buffer, so this also covers the existing
> PEGASUS_MTU check. Valid Ethernet frames are at least 60 bytes long
> without the FCS, so they are not affected.
>
> Found by code review with LLM assistance. With an emulated USB device,
> a 101-byte transfer claiming a 1500-byte frame was passed up as a
> 1500-byte packet before this change and is dropped after it, and
> frames claiming 0, 4 and 13 bytes were passed up and are now dropped
> and counted in rx_length_errors. The extra bytes happened to be zero
> in the first test, so disclosure of actual kernel data was not
> demonstrated.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Wei Jie Law <law.wei.jie@gt.tech.gov.sg>
Reviewed-by: Simon Horman <horms@kernel.org>
Technical Details
Message-ID:
<20261026163151.GC257209@horms.kernel.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351997-linux-kernel-netdev=dewy.ruReferences:
<20261021020310.34045-1-law.wei.jie@gt.tech.gov.sg> <20261021020310.34045-3-law.wei.jie@gt.tech.gov.sg>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-351997-linux-kernel-netdev=dewy.ru From: horms@kernel.org (Simon Horman) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v2 2/2] net: usb: pegasus: check rx pkt_len against the received length Date: Mon, 26 Oct 2026 16:31:51 +0000 Organization: Usenet Network Message-ID: <20261026163151.GC257209@horms.kernel.org> References: <20261021020310.34045-1-law.wei.jie@gt.tech.gov.sg> <20261021020310.34045-3-law.wei.jie@gt.tech.gov.sg> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="1351214"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:HC/Ws4iAeoKPapW39yXY5ULS3kg= sha256:RHdINDkVps/VyM+FitYppV/yw0cJosIWM9W41SLdUKY= sha1:Y1TNHjtY+YX15PSHsXzCN1RQbJI= sha256:2VFw3oMkSVoo8U8lCuNAHzlTuzAodl/gnEOq+5MFWFw= 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 B04EE125BAF; Mon, 26 Oct 2026 19:45:44 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.639 X-Spam-Status: No, score=-2.639 tagged_above=-9999 required=6.31 tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 WtDLTIdyxPFx; Mon, 26 Oct 2026 19:45:37 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-351997-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id B0366125BAE; Mon, 26 Oct 2026 19:45:27 +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 4FF13351F7; Mon, 26 Oct 2026 16:32:51 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1793032337; b=0GdqTwfWk7sqXbent4tv8anyLAAXyayWmFbjIngFzAnBTgpcXAsbpwTDYJx/N6d0ZHA8 xdhWZTrj2hsALZFaVRcAUq+Zhum/foUBDv1Et8hrsvL5nqatkDRpa3EshxJ+tCHA25PXF 67mrOJ40Uo7HqoqYqnDMDp9RZZe4QAIbtmQ+dJqEIw0aOHIdJ6UPiGaxQlf5VrGtva5M3 vxakDUgMqoElixUrqxBbicNoRLjRgGg0BJgnkZTMRlL0dlTEpHseI4TGLi4174opOk++s P1K7Hxi2nwFxp9P+SRwLL0SyIwjKTUaIIN/OWkmN2UUkTrNo8BpzFjYqDdWLN2GSlBQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793032337; h=X-Original-To:Received:Received:DKIM-Signature: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=EX6gG5Wvj0qVG3HfMkha93w8i3Ry9QCHdZsr2wWz3pk=; b=l6EGvx/GqhGJfZ/0hE49n3eA2YcUvnjKCtJZEOrs7TmUpN1/jaLv4cFOPxB+1Tm0l/S8 4stwU+hhSpcqdosDo3wwd+XrhuR2gG3KZoNODp2U46s5+ZgB/J2Pd2z/za255xiw8dJR5 YUwSyVgDq1WNvZnx+pWprs4lBKfJRB0YAwrA7RRIMMjBrCj2bcQKvnGg06ERDc2fB+wry dcG60XaTjh7HoahAJTzEEv/QFRexvfijGg/Rbs44EhrooC2+H2o5nS02fJN5uZUBMwpwY pIYgeXgHTE7Wxy65iyQ3xbU0RXCKFDks5OIg2FSbBnJKCjvOVqFotuLAs3pJuHIZcHQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZNDLLxso; arc=pass header.oldest-pass=0 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 B311E606AA2B; Mon, 26 Oct 2026 16:32:17 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ZNDLLxso X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793032316; b=kXvoA7kRH1T+CNkszvhRDIsXud1OjyuA8F8RMxSPkO1TafdMOcIXVgPulVB1k8s51YJY PwNtJGlbMlUCxpQed5DF+JecvDX8kbEnAjjyvtoQu0x009/I6UJ423Gkufelia4O8E1pV boJ4V0Rk1rs4/5RBf68ttJlTp15fbC5Vf4DdsqPyz1Nq853G70mtF1Ty0FDaE3o9WfCm0 USxwwcADvAnEycQbE5S+OXcTQ9VITa5H71qsSp0oE0jgRbkvaIFRge3QaaZWZgYaYjYvK EguaKIadyBWMVE/IzKUfODsU4NXJnZtAroX2QuDseMb6iGFTvLWMXuae+41e0hcvpSg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793032316; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=EX6gG5Wvj0qVG3HfMkha93w8i3Ry9QCHdZsr2wWz3pk=; b=DXIVY+6/syEKupcHlNajoV6lmkr7Z1SlEl+liSgLECQsGDTVjPeIbt20uuhidKYQJ5Xy cJr0prsC5Dloyu4SVuvK3Tea4//eilOt/hywOo7eu+n8hXlalzigPw1rJHsF4Ps2zLjAQ mGkiHvY/m6exWKn/15ktby4xAhdqTekR6ZcH/+6oa3mTbyp8XdFzwAzPKHYO1z3lhnn1u 5fN7iakCIqjw18fEbrJIleIw7YydyNBEoaHiJNavmTMjhevu53g5EJNlrsqI0jWf7WpN+ 0UR2TLCg6wlvoFX5Ke928rjA7u0+rvdq/su6Qtz+cXj3/ENrrGsZqIpO3HBGG1tNu1Q== X-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=ZNDLLxso; arc=none smtp.remote-ip=100.103.45.18 X-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 70A89606A320; Mon, 26 Oct 2026 16:31:56 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFCBF1F01825; Mon, 26 Oct 2026 16:31:53 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793032316; bh=EX6gG5Wvj0qVG3HfMkha93w8i3Ry9QCHdZsr2wWz3pk=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=ZNDLLxsora9vn+jug1S4dBNpkXPYzKMYU9pyucQpvsnque/2Th7Cdycj1vzP7RVAI QJ+FCQvQmUnjs9Pf8DlYMw+/xWzqS8SSGA8TmC80tKtdikgDrnCuFrntkOpRt3jmx8 LXEe5zS43iuZr+3W4t2FfpdKxtDKgUBlWNTbtyRACIb67o7sYr5thpofjc87FX2Hud 4+2KYHisxmw0Kh/qdw/NckibVvtb8Pq3OCbaPh0OXsGKjN/CikcCeWvKxWxaE27nu+ 6kK+Vo6DhVxkcYnDihli2zBxObTY7jTQ//iDrwGjVmixKxdoM2UCpeo6S3tMan9MEJ FYVFp3KnLzVEQ== X-Cc: Petko Manolov <petkan@nucleusys.com>, Andrew Lunn <andrew+netdev@lunn.ch>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Wei Jie Law <98lawweijie@gmail.com>, 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: <20261021020310.34045-3-law.wei.jie@gt.tech.gov.sg>