🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #8101

Re: [PATCH net v2] ipv6: raw: fix use-after-free in rawv6_send_hdrinc()

#8101
From: Hangbin Liu
Date: Wed, 28 Oct 2026 01:27
41 lines
10136 bytes
On Tue, Oct 27, 2026 at 10:43:48AM +0100, Antoine Tenart wrote:
> On Tue, Oct 27, 2026 at 09:38:34AM +0800, Hangbin Liu wrote:
> > On Mon, Oct 26, 2026 at 04:07:40PM +0100, Antoine Tenart wrote:
> > > On Mon, Oct 26, 2026 at 02:09:23PM +0800, Hangbin Liu wrote:
> > > > On Mon, Oct 26, 2026 at 12:48:08PM +0800, Zhou Qiuyue wrote:
> > > > > diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c
> > > > > index b965258cf..bdea82543 100644
> > > > > --- a/net/ipv6/raw.c
> > > > > +++ b/net/ipv6/raw.c
> > > > > @@ -654,6 +654,9 @@ static int rawv6_send_hdrinc(struct sock *sk, struct msghdr *msg, int length,
> > > > >  	if (unlikely(!skb))
> > > > >  		return 0;
> > > > >  
> > > > > +	/* l3mdev_ip6_out() may have replaced the skb dst. */
> > > > > +	rt = dst_rt6_info(skb_dst(skb));
> > > > > +
> > > > >  	/* Acquire rcu_read_lock() in case we need to use rt->rt6i_idev
> > > > >  	 * in the error path. Since skb has been freed, the dst could
> > > > >  	 * have been queued for deletion.
> > > > 
> > > > Reviewed-by: Hangbin Liu <liuhangbin@kylinos.cn>
> > > 
> > > Doesn't this change the device seen by the nf hook / used for the stats?
> > 
> > Should we still use the old/released rt->dst.dev after the VRF output
> > path replace skb->dst? vrf_ip6_out_redirect() said it allows the nf hook
> > use vrf device.
> 
> Right, but then in the direct path the NF_INET_LOCAL_OUT hook would be
> run twice with the same dev. Looking at other call sites for
> l3mdev_ip6_out, it's not clear either,  __ip6_local_out reloads the dev
> while ip6_xmit does not. I'm not sure what is the expected behavior.

Hmm, me neither. David might know.

Thanks
Hangbin
> 
> Regardless of that, the change in behavior (if right) would be worth
> mentioning in the commit log.
Technical Details
Message-ID: <auFPlcB4VfQ76NYC@fedora>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-352696-linux-kernel-netdev=dewy.ru
References: <20261026044808.613-1-n0ps1edzz@gmail.com> <at7uk8gXtzNufuQF@fedora> <at9sKRSEJLVGj9OK@kwain> <auAAmqXcxmC6BDrR@fedora> <auBs0Xn5yVJ1NtdK@kwain>

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-352696-linux-kernel-netdev=dewy.ru
From: hangbin.liu@linux.dev (Hangbin Liu)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v2] ipv6: raw: fix use-after-free in
 rawv6_send_hdrinc()
Date: Wed, 28 Oct 2026 09:27:49 +0800
Organization: Usenet Network
Message-ID: <auFPlcB4VfQ76NYC@fedora>
References: <20261026044808.613-1-n0ps1edzz@gmail.com>
 <at7uk8gXtzNufuQF@fedora>
 <at9sKRSEJLVGj9OK@kwain>
 <auAAmqXcxmC6BDrR@fedora>
 <auBs0Xn5yVJ1NtdK@kwain>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="1676253"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:6sj5ayOJpbpkSIzml2U5Lq24ffg= sha256:0v4TAfzQoTqZbQuMn89uU46LX9renoGd5cLXCWbYipQ=
	sha1:v+4W+2taRgk43ggnh129PGcBODk= sha256:jy97ptKpGz5EDsmg/H9mI2neCNRcxxOrRavNOJmnB9s=
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 E32FE125C2A; Wed, 28 Oct 2026 04:28:31 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	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 (1024-bit key)
	header.d=linux.dev
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 7J5PD4w-ms32;
	Wed, 28 Oct 2026 04:28:24 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-352696-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=linux.dev
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 54916125C1D; Wed, 28 Oct 2026 04:28:15 +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 0F27E2A210; Wed, 28 Oct 2026 01:28:13 +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=1793150892;
	b=lqa3yCWDSMNFCVCdybf9pQyq4YY2gs4Q0ZKMULPC79r8A0CluDjmQ89WGu2FhYo8gSps
	 1UDz2kWY444clsQuCI9swhfppXDoMRj92dRQtQ9BNnSvKYEZDdaijgdRwsiDV3l9rCnQ+
	 lAqVm7eu1eO09ddMQWCYBxOOB01RMrFRryc/GAgUn8mm3f5+Nka5wWeZOe1RVEnS15z1C
	 gnNa95M4+mN2xbA/x80WmbJS/2Z5Yaaw0v06iOdusOtD/JWWXu2FDA1Ln6NulAaWgizTo
	 CEE7BllvwHv/kWauhFR2Pjqsxv6syO8EDuQwrAFWh7+LAhc6/H2de7op2IkPjuNxDcQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793150892;
	h=X-Original-To:Received:DMARC-Filter:X-Envelope-To:DKIM-Signature:
	 X-Envelope-To:Received:X-Mizu-Trace-ID:X-Migadu-Flow: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=OoEszvGm7Jt8r2Hgps9BAadui447M2pxW0SiVZm0x7s=;
	b=5AI8m1AVXpR+roC4U9DgCaiGChxfBVJloSaxTYGagOCn8iUG4+yb/+ZAzk6ss8PL3IBY
	 jbzFszNUakjUG7/nbR2oRaBc671WAwWEUakEHQbSRsYNLcIQdMQPOgH6M5G3b/QBgWB7J
	 7rjklQCBVHsDNvyT/WTeVn9LHsnKo7mC1COC7vXJ+Gwei7+h18HjjAdhEngCWCaELk8nJ
	 KmJfow/t60TeFmN/u5XeLldxrSrQDpzwGbxNZPAIPNY/HMbVnnaZPbjUH+WkzJBNAXOQ1
	 mIhTLlbX1FNubVRLlAoyImWTA4/i5FL5dn4hKnqM7KJ8x62bCf8svLjFmgyDeigPQ/Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=rkp7nNL0;
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	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 6138B606A325;
	Wed, 28 Oct 2026 01:28:12 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=rkp7nNL0
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.169
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793150891;
	b=LZ5a6jAxjhdwnGfyjLoWriLudnXrF2wP5WAZG4laAeyRLamGgOk7p31P11M6CgJUnWuX
	 qBsr4iWQdtL8a/3N2/r9YUEXctKL4yiZg4Bwp+DprjnDSPYN9V4wTmLW/XZPqNr6H6MnR
	 vikmdqokyXfZkay10ChMltI9dggxoVJ8v9eMUqsLZkR5arNvD6WLrrJcQqyV5VTGr884A
	 Mn6cK3eyH0cN6Clfn+1gv+Nhry9XPzz04RCnKLyHOMGVNmS2TvCiTpeP/nMIz/8hjQqtm
	 REgPJ+8VeHQNk4lnRrXaiYPEVJgC4tR8pqWbl92Awdk9tKiHUbkeaEHS7kxntkvVGHg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793150891;
	h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received:
	 X-Mizu-Trace-ID:X-Migadu-Flow:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=OoEszvGm7Jt8r2Hgps9BAadui447M2pxW0SiVZm0x7s=;
	b=DQ/DafmLPZV/wt624mG9uuV1yulpIYO0K+BzV/hgskg9/Cvs7luu82Z4bilmAbQqjAgZ
	 sEoHnc5z9dH4XTInIvSky1g4eON9HF7EkITzbizb9Sz/xB2WXVxbpFYQN1Ti5zE3BCAf8
	 4P2arIpjrhpbyfebVFXUBL1vXtaWGXXvL7mxhGtEbdWWzkHykMzBNZPKeFeGtMY/k/WwJ
	 GvhchCRljamG/Ypj2aSnvt40DE4vthW1Qb6gKXsLGsz5UbAWjDieX1uzQMjf02uZOYDsY
	 Q22cM3x+fdXuKp0VmJrWhsamW/MrAivrWf/dfw113H03YBG7T1LrTzEZ/rRBNhTtY7A==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=linux.dev;
	spf=pass smtp.mailfrom=linux.dev;
	dkim=pass header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=rkp7nNL0;
	arc=none smtp.remote-ip=95.215.58.169
X-Received: from mta1.migadu.com (out-169.mta1.migadu.com [95.215.58.169])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1DCF0606A31D
	for <netdev@vger.kernel.org>; Wed, 28 Oct 2026 01:28:08 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1DCF0606A31D
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev
X-Envelope-To: netdev@vger.kernel.org
X-DKIM-Signature: a=rsa-sha256; bh=sbvDgc3joPyy/j914OEP6tCwRBpNWUQikTAlXej1Uq4=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1793150886; v=1; x=1793755686;
 b=rkp7nNL0OLdSYcb59MXeFHASOBTGrfoVXSeiDOAzcm6l2NlZvGUgzPFj1S+1o86f7XPYvI3/
 6bb/0LcC7zO+bwkuQX2rgJIdUS3cr0StXRACoH///yv4lMgTmRbdiNo4WddWx4oIaVa3w7WWiNw
 qraOAe9NEp20TCritt5BRty8=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by mta10.migadu.com with ESMTPS id 47897f4e5ab642e4;
	Wed, 28 Oct 2026 01:28:06 +0000
X-Mizu-Trace-ID: 47897f4e5ab642e4
X-Migadu-Flow: FLOW_OUT
X-Cc: Zhou Qiuyue <n0ps1edzz@gmail.com>, netdev@vger.kernel.org,
	Ido Schimmel <idosch@nvidia.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@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: <auBs0Xn5yVJ1NtdK@kwain>