๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12380

Re: [PATCH net] 6lowpan: fix netdev_priv() type confusion in lowpan_event()

#12380
From: Eric Dumazet
Date: Fri, 06 Nov 2026 23:50
35 lines
10309 bytes
Le ven. 6 nov. 2026 ร  23:59, Roman Gushchin <roman.gushchin@linux.dev> a รฉcrit :
>
> lowpan_event() assumes any netdevice with dev->type == ARPHRD_6LOWPAN
> has a struct lowpan_dev in netdev_priv(dev). However, non-6LoWPAN
> devices can also have ARPHRD_6LOWPAN, e.g. a TUN device via TUNSETLINK
> or a bonding device inheriting dev->type from its lower device.
>
> Bringing such a device up or down causes lowpan_event() to read and
> overwrite unrelated netdev_priv() memory. Since unprivileged users can
> create TUN and bonding devices in a user and network namespace, they
> can corrupt struct bonding and trigger a slab use-after-free.
>
> Also check dev->ndisc_ops == &lowpan_ndisc_ops, which is set only by
> lowpan_register_netdevice() on genuine 6LoWPAN devices.
>
> Signed-off-by: Roman Gushchin <roman.gushchin@linux.dev>
> Fixes: 5609c185f24d ("6lowpan: iphc: add support for stateful compression")
> Fixes: 2ad3ed59198c ("6lowpan: add 802.15.4 short addr slaac")
> Cc: stable@vger.kernel.org
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Closes: https://sashiko.dev/#/bug/linux-97b284e0-576e-4373-b62f-eb132f482b91

nit: Signed-off-by should come last, after Fixes:/Reported-by:/Closes:.

The fix itself looks right to me: lowpan_register_netdevice() is the
only place setting dev->ndisc_ops to &lowpan_ndisc_ops, and
bond_setup_by_slave() does not copy ndisc_ops, so this is a reliable
discriminator.

Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Thanks.
Technical Details
Message-ID: <CAL4Wiiq7SweZDnbyBYAfg4rvJxowWtO_5LnB8-hnaNR2K228OQ@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358242-linux-kernel-netdev=dewy.ru
References: <20261106225930.1379968-1-roman.gushchin@linux.dev>

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-358242-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] 6lowpan: fix netdev_priv() type confusion in lowpan_event()
Date: Sat, 7 Nov 2026 00:50:00 +0100
Organization: Usenet Network
Message-ID: <CAL4Wiiq7SweZDnbyBYAfg4rvJxowWtO_5LnB8-hnaNR2K228OQ@mail.gmail.com>
References: <20261106225930.1379968-1-roman.gushchin@linux.dev>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="4004624"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:o89Li7aw6f5PnQKeariqQwI7NRQ= sha256:DTPoZR8FmTTGmOzbvOJ5nxRwOTW8dwBR+ZK/qT4KRos=
	sha1:74O5WlUPHddNLkfnqiSILL15hvM= sha256:b8d4PWEwNb+CCGDNZGhFW3rcCu/zhdSXkgwQo8ZudnA=
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 25C7B113381; Sat,  7 Nov 2026 02:50:29 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.501
X-Spam-Status: No, score=-3.501 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, 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 JffB5oDt_-fq;
	Sat,  7 Nov 2026 02:50:25 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-358242-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 1F47E113357; Sat,  7 Nov 2026 02:50:16 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 8E576602854; Fri,  6 Nov 2026 23:50:15 +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=1794009015;
	b=Z/oUJcFfcFRAXoVqSZnmVaJHjEXb8x3MDei/LN9cvWmPkAKxyWtv4vy8V1hsQirKO+oz
	 9JDeNgzDn/EcMTDm3qZmRP98LH56s1cSPLPD6SEh3kU9+xSLnNzYtJ2H24LQ2+QMdNCpH
	 QSzCUglat/Cqqgm6Lb86wOtLweohpUfFCTzgZ/sJEA77Du82cDt0AWLq0X+JNpWNpkZva
	 HsdYBourFbX388W9x5/vpF3d9AZful8FDf8RT2ZUVRkaGXdAOvAmZjsfMu0n9oIqms9Ow
	 eQPWo2PSwaweGIzm2DoLUADZLhVppQf6iFaazmpRzL3PADoO4IGBRsgNmEYnyZwyPPg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794009015;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:References:In-Reply-To:From:Date:
	 X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
	 Content-Type:Content-Transfer-Encoding;
	bh=DcXU0oExIDedQwC/01NHEk+Um4PsVTZtewa33aoXSV0=;
	b=dBElGSuoEAqfJC59gh+gHUIWR/Np0z/b2uBRsw/kz5/e09cTEeOZF06NvtHYBJ0W3tXe
	 QyR05s5VRzrsyDLmdxAbFfgTqS6FJuanUgxKkVSMxFVV7R858Hd1/oK9jMPFpRCc1tRRq
	 fBTpyRZjmfVvI17ZE1OgEg2gNulL6Ah2Xn//SP7EM9qJVRdjM/78L1565YwBiHn5JfI4E
	 0GYrG1LzEACzpe+7iUmbZuuDW6YZ5CSrKajlMQkaXJHGx3vKKfLh4rHjqd5b30UA+xZN0
	 55ocgjaoU3Zg4Bfn+pZYElcKI33SwNz2IDL6aUL+FLb2jBYmVXty/bzEPN/68l9oCJA==
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=TxlXosMy;
	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 E550F606A33A;
	Fri,  6 Nov 2026 23:50:14 +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=TxlXosMy
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=1794009014;
	b=0bbDVwsbw08zbytZrXUHNsaB36eOt6LEOo9LXem3iyV2pscP7BuclpTyQKjcSjz4fleH
	 rX+j1x0Y09xGHU4FWM2sJANClaArHkrG21oWJaKrwqHS17pZ+xoD2M0dIIeGE1zF2MTjF
	 1Nbs7h3ocN1HCkr397tP97orKHMi7M/HbNCZot1+e54ovp6gk6hLpS0V6UNPveQHQ14sd
	 +dl/poHvkzr/8NI2Lot9rSoEujcblU6ei+AvYlzo2XM0hnlmaebfItWiAx/09tGZTFZpM
	 pcAuWpD0HU1rwOpyBsgUunvQ10YnG7CmS5xpu54PBRCydWV7KI1xWnV+CuYfhaXEaCw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794009014;
	h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted:
	 X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To:
	 From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:
	 Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=DcXU0oExIDedQwC/01NHEk+Um4PsVTZtewa33aoXSV0=;
	b=WHCrK/7AsNLiXYyNpk3wleINY160MDPEdL0DgoVgQWPVLhjheht0w6nqHVpX8sNsxjKj
	 UZEvXYwjIziuXLFWA9TNcseSCF+x8nay10kKG0EAVjEgOlABWYPoeKSbH1Q6Q8m6/Usss
	 n3BetvUPwqgBxni8Y1KmiIdu/EPowJ6nlOPfWa6AgvtTBb6btsRwKweNu8h5o2xKWOHMz
	 2zP41lQzrfeAGpF/2RLDX4xCF0tIxtznYNcuqnUNd/a0H5zBJUO5CH/UwjrGWGLSMgPEv
	 FILRhqJtdbvXXh9ty0DefJItsh1GF3ZUwnFoloYX66pB3Wo0kXyOtPfT5B7dl181X+Q==
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=TxlXosMy;
	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 BC6F1606A32C
	for <netdev@vger.kernel.org>; Fri,  6 Nov 2026 23:50:13 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD79E1F008A7
	for <netdev@vger.kernel.org>; Fri,  6 Nov 2026 23:50:12 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794009012;
	bh=DcXU0oExIDedQwC/01NHEk+Um4PsVTZtewa33aoXSV0=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc;
	b=TxlXosMyFrKzbA7E2GTcZqpq6FJ0PDONXBMs1FkC/HZE4Fff5YVAoK1YUYUZNZ14I
	 /uQ4EJAYtPxNUDG3DO+MllJEMMF+TPnKscZgfRyBNp21F9AlRuEmLhoKDpBbBzKy6S
	 dw7r3zkS0RLmB6PNcRbh5/DNnSFAzEaughBGAHCsEVcqBNhEaBP7ICTRhTLzirx972
	 nQU/A99dgYKPsvLTwOTtb0b+6i475eQJjp8i0ks5W2MguTBfMGMycUjE+mksQ8vXEH
	 v5JBLf3CgqxSZhgAx59qIhftfQw3P3hWWshpLL2IXmwSaJzx8fWEYik2M7j139/Ykh
	 ZBqx7QhPjkpMQ==
X-Received: by mail-oo1-f45.google.com with SMTP id 006d021491bc7-6de2f213b7aso500695eaf.0
        for <netdev@vger.kernel.org>; Fri, 06 Nov 2026 15:50:12 -0800 (PST)
X-Forwarded-Encrypted: i=1; AKwUvBzzrpL4MWVuTMAwdGAabyvp0BOgYu5E70Xohmt80u6pAIEb/kttNXcbKwu+0VZSABMuzFPtvRc=@vger.kernel.org
X-Gm-Message-State: APuU4Z+kepffwiAf1ICWh84cKmhDat/zXshD48YIF203P7e2+JM1uKKb
	oASJDX4S/OyhjMOEjzsbShZoAZnFiJy2ZT8URPYrS8vtQFFbFjqh+U1I4JIK+NmfCH0EzrVnThQ
	8L/qSADCvmWonHJplwzpBt+tctDSlioc=
X-Received: by 2002:a05:6820:f036:b0:6b1:d09d:6d73 with SMTP id
 006d021491bc7-716e73cce25mr2420784eaf.8.1794009012160; Fri, 06 Nov 2026
 15:50:12 -0800 (PST)
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: <20261106225930.1379968-1-roman.gushchin@linux.dev>
X-Gmail-Original-Message-ID: <CAL4Wiiq7SweZDnbyBYAfg4rvJxowWtO_5LnB8-hnaNR2K228OQ@mail.gmail.com>
X-Gm-Features: AclHuK-_5NxlKe0tcJTJSD6o8Lrzde1RmDvupDJo9TYr2AbkqTlhAlZ6Fe_nV8U
X-Cc: alex.aring@gmail.com, davem@davemloft.net, kuba@kernel.org, 
	pabeni@redhat.com, horms@kernel.org, netdev@vger.kernel.org, 
	linux-wpan@vger.kernel.org, linux-bluetooth@vger.kernel.org, 
	linux-kernel@vger.kernel.org