🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7567

Re: [PATCH net v2 1/2] net: usb: pegasus: do not advance rx_skb->data on dropped frames

#7567
From: Simon Horman
Date: Mon, 26 Oct 2026 16:31
39 lines
9894 bytes
On Wed, Oct 21, 2026 at 10:03:09AM +0800, Wei Jie Law wrote:
> For the 0x8513 chip, read_bulk_callback() skips the 2-byte receive
> header by advancing pegasus->rx_skb->data in place. This is done before
> the pkt_len > PEGASUS_MTU check, and when that check drops the frame
> the goon path resubmits the same skb with the advanced rx_skb->data as
> the transfer buffer, still PEGASUS_MTU bytes long.
> 
> Every frame with an oversized length field therefore moves the receive
> buffer two more bytes towards the end of the skb data area. A device
> that keeps sending such frames makes the host controller write received
> data over skb_shared_info and past the end of the allocation, and the
> corrupted skb_shared_info is used when the skb is eventually freed.
> With an emulated device sending frames filled with 0x5a on a KASAN
> kernel:
> 
>   BUG: KASAN: slab-out-of-bounds in dummy_timer+0xade/0x3f00 [dummy_hcd]
>   Write of size 1536 at addr ffff888105821202 by task swapper/1/0
>   ...
>   Oops: general protection fault, probably for non-canonical address 0xeb4b474b4b4b4b4c: 0000 [#1] PREEMPT SMP KASAN NOPTI
>   KASAN: maybe wild-memory-access in range [0x5a5a5a5a5a5a5a60-0x5a5a5a5a5a5a5a67]
>   RIP: 0010:skb_release_data+0x36f/0x800
> 
> Only skip the header with skb_reserve() once the frame is going to be
> passed up, so the receive buffer always starts at the beginning of the
> skb data area. Unlike the old pointer adjustment, skb_reserve() also
> moves skb->tail, so the two header bytes now count against the buffer
> size: lower the length limit for the 0x8513 accordingly, otherwise a
> pkt_len of PEGASUS_MTU - 1 or PEGASUS_MTU would trip skb_over_panic().
> 
> Found by code review with LLM assistance and reproduced with an
> emulated USB device (raw-gadget + dummy_hcd).
> 
> 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: <20261026163133.GB257209@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-351996-linux-kernel-netdev=dewy.ru
References: <20261021020310.34045-1-law.wei.jie@gt.tech.gov.sg> <20261021020310.34045-2-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-351996-linux-kernel-netdev=dewy.ru
From: horms@kernel.org (Simon Horman)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2 1/2] net: usb: pegasus: do not advance
 rx_skb->data on dropped frames
Date: Mon, 26 Oct 2026 16:31:33 +0000
Organization: Usenet Network
Message-ID: <20261026163133.GB257209@horms.kernel.org>
References: <20261021020310.34045-1-law.wei.jie@gt.tech.gov.sg>
 <20261021020310.34045-2-law.wei.jie@gt.tech.gov.sg>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="1349459"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:ybjiOAkKOUgbEOs5HamziARADW8= sha256:3O2Bpg0rJRcaXHkM7p2zXgqY41FYKHO1NWEyXiurXvs=
	sha1:9yKz/6cRD/QIJgzimaD4a7XHlpA= sha256:duEU/Y6mbEZdIVeF56qLqgD5Np7lIW2hhVCftLP43bA=
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 6190D125BAD; Mon, 26 Oct 2026 19:36:32 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.739
X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31
	tests=[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 gXY7HHg3MomO;
	Mon, 26 Oct 2026 19:36:29 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-351996-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 636D3125BAF; Mon, 26 Oct 2026 19:36:20 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 2AA90289C4; Mon, 26 Oct 2026 16:32:29 +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=1793032299;
	b=f52mgTiuI5hsx1v26I8NPxVjxKqDQ71QgJ60hKsTMDyyrWH7FgUIj3SMH194g94w5sd8
	 otYehoEkWGx7AKYdJRZtyYiF+/22SwbJ0NoGZghuvqabA0pJmSfkgxkbTCJ9zWX4cTJII
	 dbJLCn71cpeAkzJ51LvTrP735SSBjDojoimXXEjVfC0xRRM7EgCCanheJUpB6O5I0q4iw
	 W/MOB3IOOEWdXadUCnneu+jxI6jHDDZSm0HI7FF5hATTbEJg+HVv7Y9modK1U5Ub4xmm6
	 G29JDK90t+plH5rTrD5shhPl2GyIFCeD5sWfmShf/9w6A5vdV9NQmORIRTPaKng3gqQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793032299;
	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=Shx5Rs3ERCYkBOzZH3Om29/lV20CBoRJBqj6ilDEc3c=;
	b=x1hDo8sY5CbB84lg85CvIgI8X9CdZ3T5hJ5TX+1nIi3LXyI2OqnXWTa85YB++/VJAepj
	 lNm55agdk6Cmdpb9dU1muNwExzeCafpKMnclDGQDBjIf0Ryiwc/JMRVmUGQhKVocfpmT/
	 LNC76OTPAVF4qWrtxTgNDGoKVfu6v94Q2CaM9CCluihncwtspgZ/UFPYe9AOf3CHLDxYX
	 6PaovOLNhBSXcqk7W8oenNZZ09Lb6j5Zmd9jpeMhxlrkn6LaqcEkU8GTPXTMT9XZFxZKx
	 z/yxJAzSwaoYsmlIBVh0XLeOBDh7FJ9YrhOoLB1eJRebNZ9eTjsDn1Du7uL5TsRUskg==
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=W4NnhW5t;
	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 1A651606B7D2;
	Mon, 26 Oct 2026 16:31:39 +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=W4NnhW5t
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=1793032298;
	b=yIxDjy+Q06wpKuBeOZ1LzP1FtHUe7qrhRgg3SMJyo7JsgVs3PILEIyfwr72SK7FdQEDh
	 OdOVwXt+ROgvzTS5cKjqb3kyAu6IuuanA4pONJXERNYUZriN0K/lEQn76UFKgtLUj5oWJ
	 uPbGzJawqnqC7XWv2XI4gNejw58Ef+dv5QgwN4jJgjdSkPzXynhKz/s85CY008UV7UEqb
	 ta8lKorGpmmWsHat4Ez6V5a5NJCAOETfLuFZFrvZ0WVw3CJshcAQXrmpGVVPTYzFYQszp
	 WSgOo36xvbmvN+kBRmhMQc7JXhS3ZOdYJEkBlRsU8TFpMkumWdwu7pc8TL+7Tu08qiQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793032298;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=Shx5Rs3ERCYkBOzZH3Om29/lV20CBoRJBqj6ilDEc3c=;
	b=q7bVD+p0qF2gBhorBoI1Ym23NhG9JJKglY8caFZV+kRd+78KUzmhs5hHPjSYHXm3Yc4y
	 VnWwxfLJ5MrvwV6urDC/eCIwnPXBsdECe2SLv9Po+RuDC13qFz4xFZc5i4vNL+/otp2IO
	 FuYrgZbBQiKs+Ph17RgpOotN5Kg8Es/z8GapQusEF2X+zqReFuidYb+B08RQQNHRWS3rc
	 kbqhzc5MI/MYJuhwFpHT2/t48uuVIPIQbGzJDnkRfDCR3ymn1gux92a489DPM1mWgtl7U
	 Gq4fPdWGXJeVhZYIVX4/Bpk6yEzOObSCygcgYrB2W0LXUElpYchJDOWinE6Ihh+XHeg==
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=W4NnhW5t;
	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 EAEE9606A320;
	Mon, 26 Oct 2026 16:31:37 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5801A1F01825;
	Mon, 26 Oct 2026 16:31:35 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1793032297;
	bh=Shx5Rs3ERCYkBOzZH3Om29/lV20CBoRJBqj6ilDEc3c=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=W4NnhW5tI5ka9y1/OjFrGob6cRzM9clGGgXqK8fZtXTrXzUmjPLdtzl1xBOfN7vFQ
	 WOPqaWANvaXnd47mUjOySkWOxQeoRl6qVuTkPqUaAIURXxVbykQCiqSVIcwayOfTf8
	 mzWA5N9u7K3n7RjNMW5ANrwYfypvDtvAfD+FteQAhxa9uzJHwM5qD2iYiv+dxzXKXh
	 S8EiyE6OjL9L7dKFCGrYUqcFHXBsBfmlPf+FEsuiRETEMQpZem4K6YKIZ8YSNTYuML
	 EPGYaiirYPgT3Z+E0iAGYavUzLhjxtnEHckT9KJJeIbPoujVmIG1HaxtV4g4puShKF
	 zJpTFb5j7rfBQ==
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-2-law.wei.jie@gt.tech.gov.sg>