🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26205

Re: [PATCH] ieee802154: socket: fix shared skb BUG_ON and double header subtraction in dgram_ioctl()

#26205
From: Stefan Schmidt
Date: Thu, 03 Dec 2026 08:04
31 lines
8652 bytes
Hello Hui Peng.

On Sat, 19 Sep 2026 21:28:55 +0000, Hui Peng wrote:
> In `dgram_ioctl()` (`SIOCINQ`), the queued skb at the head of
> `sk->sk_receive_queue` has already had its MAC header stripped by
> `ieee802154_subif_frame()` prior to `dgram_deliver()`, so `skb->len` is
> already the exact payload length that `dgram_recvmsg()` will return to
> userspace.
> 
> However, `dgram_ioctl()` computes `*karg = skb->len -
> ieee802154_hdr_length(skb)`. Calling `ieee802154_hdr_length(skb)`
> re-parses the payload bytes as an 802.15.4 MAC header and calls
> `pskb_may_pull(skb, ...)` while holding `sk->sk_receive_queue.lock`.
> When multiple `SOCK_DGRAM` sockets receive a cloned copy of the frame
> (`skb_shared(skb)` is true) and the payload is non-linear,
> `pskb_may_pull()` calls `pskb_expand_head()`, which triggers
> `BUG_ON(skb_shared(skb))`. Even on unshared linear skbs, subtracting
> `ieee802154_hdr_length(skb)` a second time underflows `*karg` to a
> negative value when the payload is shorter than the bogus parsed header
> length.
> 
> [...]

Applied to wpan/wpan.git, thanks!

[1/1] ieee802154: socket: fix shared skb BUG_ON and double header subtraction in dgram_ioctl()
      https://git.kernel.org/wpan/wpan/c/0c732cc420a8

regards,
Stefan Schmidt
Technical Details
Message-ID: <179628507733.223960.6667299266274351065.b4-ty@datenfreihafen.org>
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376389-linux-kernel-netdev=dewy.ru
References: <20260919212855.3241205-1-benquike@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srl.newsdeef.eu.MISMATCH!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376389-linux-kernel-netdev=dewy.ru
From: stefan@datenfreihafen.org (Stefan Schmidt)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH] ieee802154: socket: fix shared skb BUG_ON and double header subtraction in dgram_ioctl()
Date: Thu,  3 Dec 2026 09:04:42 +0100
Organization: Usenet Network
Message-ID: <179628507733.223960.6667299266274351065.b4-ty@datenfreihafen.org>
References: <20260919212855.3241205-1-benquike@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2431648"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:vKY1v/I3dmqZtLcnuGZ6UjO1cC4= sha256:GBrdTieL05MJ6MesB/VV3A11dSY4Ahyqy4jo2kBYUcA=
	sha1:+489Lf8y45qQTzeeeYgZ+9VlzhA= sha256:6SZ+ZKASvPEe2DBennWTWnwmFiJaWJGdvWIPHnoSQ0k=
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 91918117879; Thu,  3 Dec 2026 11:05:12 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.951
X-Spam-Status: No, score=-2.951 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=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] autolearn=ham autolearn_force=no
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 iSTVCmqlysvQ;
	Thu,  3 Dec 2026 11:05:08 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-376389-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=datenfreihafen.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id C9012117869; Thu,  3 Dec 2026 11:04:58 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id 7EB5520AAC; Thu,  3 Dec 2026 08:04:53 +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=1796285092;
	b=hh7BGBAdT9+VVFEMcsNKIz88P0BTXA9ukRShymKBZV5SN2ve6TA9/AQS5lNaWIBg4SWE
	 uZmaoKKtpw4gyn/XTMl+jWl+PuAXMq7dfi/s1ftvt2XKHxLgm9Su3NjZX2x+5WnPgG/MS
	 b1AvFMMgsyK50XAmW7sgnjMycCoIE1muBfzvxZTv6Xqf/qjaSmqgxCrWKDNy3+OVhGiPU
	 ONTiQPKVv/0naJaoIqTlmhYohsspwvThe9bv8wZKXsmjLpQFtArA9ll8LykMV0n7KS3kZ
	 WDa/2DZJmjbalHeWjM6x7+jxMrlRH5agv0elEgEimIwhGvmYUieuPlH2AlF2yOskNYQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796285092;
	h=X-Original-To:Received:DMARC-Filter:Received:From:To:Cc:Subject:Date:
	 Message-ID:X-Mailer:In-Reply-To:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Transfer-Encoding;
	bh=4kRrPLzDrtj0oYgEz8oQGqDl2vmNwFZu+804102vfx8=;
	b=ROpMJjzChrWbvizVnzVN8f+d3EmVHzEJ9lKXGMNnl3UaDoTbvRW0UX2KhZv65sqetO2/
	 lHgnCjGd+ev3T8g2EPficlI32g9ZGxzH9sKHKWxAp6c8NJ2mg+0UemIQWVDmbWiLhMrsy
	 a1Mj9E/nvFhUM9PPcagI1WcB0R3P02ryKXOEmhNLq7lU+OgB8CY7b6W9pIDNZF5fnLqmJ
	 YqO6n1fnPFIgDu2LUSgOMdX3SBWcePhb8z3RMouGbH91HO/QHTWz2PyyZrCU8BDwyj6RO
	 /BtZW2A3dH/x6WVPBmPyKSSfqH6kPCrNgYT1DejRCWi0Z8qvyO0mn3K1t5WhIwXR6wQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=none header.from=datenfreihafen.org;
	spf=pass smtp.mailfrom=datenfreihafen.org;
	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 534A5606A33C;
	Thu,  3 Dec 2026 08:04:52 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=78.47.171.185
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796285091;
	b=DwzkOoTdu8fYBdq9iW7SBMvXB4qAYOnPR5l4ozb2HJXfOz4+IDM5eeFIZcyjYZzrPTSl
	 RoLG5fJDEOt2J8jvmFvdv3XouegjPfCItCpWelIma3Chbsd6mR74Q+oty4gzwrnyzCTiL
	 /Lf2+kjSiAeuGuG4XPonZ3/EKqstMCZLZV+A1h2OiV6uyA1WT/5mxk9JBmudn/MaDoehm
	 haAvGnxI+I5/7vQbjP/K9EnyYCYdkrQG+4llFp6DvmpsnmwPYZgcCiACrDFL2cC0QmZts
	 hPucBO7NdvvTZ6lfOEjaUoaJ+MEFsNW9MP/i4/ldOVPrRF4tKECqh57zp3qH69sQvew==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796285091;
	h=DMARC-Filter:Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 In-Reply-To:References:MIME-Version:Content-Type:
	 Content-Transfer-Encoding;
	bh=4kRrPLzDrtj0oYgEz8oQGqDl2vmNwFZu+804102vfx8=;
	b=lr4xbpA1oHaKxdb1WRWocyIl+yEwEvmcrerWnteEBTo2oExV6xXvehW4DVpzNQkDhLwV
	 gSg7nGQtNqXVVhhJlyxPxGEF4+8yFInlDo9g+3HUutcGidFtCEuukXjdSOA2Hu+yG4FG0
	 pffEbzn1KWaAqLEOOc49nYJXTsuv4tmwlCv+NKtcoQSY9JKZDunYYZ+g55QnA8Ngg/wEz
	 lsgibVpKdWS3yekoe1TPvdZtDvthPrzG5cBMwwfZM1kHZyGoE/+QR1tj6EsGR+31uqM20
	 Nc1Au8AcgEizSSo5aOqRChMyuU76MSsFZd5/9VZaiGG2fmNB1IGqprEFHns20eI1M3g==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=datenfreihafen.org;
	spf=pass smtp.mailfrom=datenfreihafen.org;
	arc=none smtp.remote-ip=78.47.171.185
X-Received: from proxima.lasnet.de (proxima.lasnet.de [78.47.171.185])
	(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 3EE8D606A322;
	Thu,  3 Dec 2026 08:04:51 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3EE8D606A322
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=datenfreihafen.org
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=datenfreihafen.org
X-Received: from work.datenfreihafen.local (unknown [46.253.254.165])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	(Authenticated sender: stefan@sostec.de)
	by proxima.lasnet.de (Postfix) with ESMTPSA id D0C78C0A19;
	Thu,  3 Dec 2026 09:04:48 +0100 (CET)
X-Cc: Stefan Schmidt <stefan@datenfreihafen.org>,
	horms@kernel.org,
	linux-wpan@vger.kernel.org,
	netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.56.1
X-In-Reply-To: <20260919212855.3241205-1-benquike@gmail.com>
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