🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #7707

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

#7707
From: Hangbin Liu
Date: Tue, 27 Oct 2026 01:38
29 lines
9475 bytes
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.

Thanks
Hangbin
Technical Details
Message-ID: <auAAmqXcxmC6BDrR@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-352160-linux-kernel-netdev=dewy.ru
References: <20261026044808.613-1-n0ps1edzz@gmail.com> <at7uk8gXtzNufuQF@fedora> <at9sKRSEJLVGj9OK@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-352160-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: Tue, 27 Oct 2026 09:38:34 +0800
Organization: Usenet Network
Message-ID: <auAAmqXcxmC6BDrR@fedora>
References: <20261026044808.613-1-n0ps1edzz@gmail.com>
 <at7uk8gXtzNufuQF@fedora>
 <at9sKRSEJLVGj9OK@kwain>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="1441207"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Mas6WTTOxDyw/rAnNMCN5SG1Mjw= sha256:0Ik+QXVsXlGrT59+BM63OWYFZZgLfcXE72FK83fA/fs=
	sha1:wr9hmyX+ID2lbs/HP0tCF4vJeYo= sha256:rrvkQ2QcEYdGV0h3sYGmyAizSQU9u0ojVZKQw2beAnI=
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 253A9125BD7; Tue, 27 Oct 2026 04:39:48 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 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, URIBL_BLOCKED=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 C0qKFZHsLRHL;
	Tue, 27 Oct 2026 04:39:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-352160-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 96BF0125BC4; Tue, 27 Oct 2026 04:39:35 +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 7818A2B1DF; Tue, 27 Oct 2026 01:38:54 +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=1793065134;
	b=jg3qu8REQBYpjpPNUnDBj7IyQZ5vrQqhFL0G4/V/oQau3Bf2+fpRMUivLHpqC/NGg4zg
	 KUfaYclefj81laZ1UWOTVotKQ1UayPeIhNlEQ8Un/axpCix5qghbKZ3dLwHII/AdgFooe
	 /PsD4ofy72zszupe/Qkt6cJ+OOezgIZEiEQH5dL2hnFHQIpkAvnPmtOS3SM8OGne1qa0w
	 8e01CMmuJw6V1HdX4tmWPt/jJDc2q20vM5hciz8ZLfQPlFJ2Q661PGhhs19CPhpxAkzxF
	 i/uLSSBK4JIAmTLonDsOTdavubvpGvOTGAJckhujZJKKyb63oHwzhcdcq7oRlsi+Pxg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793065134;
	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=Z5R2y4WIB6GYJwGdw7y2Iv9L7vI0mR86YCmyG3VujCs=;
	b=KvzboRYi4xRZe8qr5gVtRCJ2I/ui98cIpP7SDux/mJSx67EU3F9OKyNEGymseBUa/JFt
	 defi7CSXL8Djq5yJgfsK6yatJjuZ8nBiOBMq6HNRfW8cpb5YMghmU8jrpgv281M3m8ysb
	 BEC+AxqZL35wQ2WrPiuWudrwgphDaMZJ4hykLWwtT/c705PRbsY0WFQ/qrurnOLPilo5b
	 5vuZCncievDNxHQUgXdsEbKUaJUXG57MrrkB+qUnQlXpDr/KhQzjRL1uWmOHexlfliwKs
	 DKuUF3394xSPtxTWAdMR+7KzLt745CU7UlfTxrTxCbEjDaBw/cA5qfUdmJgLhmepA3A==
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="ZHlNrt/e";
	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 2485F606A328;
	Tue, 27 Oct 2026 01:38:54 +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=ZHlNrt/e
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.207
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793065133;
	b=dTs/6w6q/WMg1cRI4s12kTU4yX79TvGynf5VVB9WmaH4m5IsDSUExqnvOtscUm9tC7dm
	 bTrK4uDc6zhltzyDLomZIQWnn5aEUOZ7FeM1M2zMFwAw3Byg+plbrAhU3xfIYal8CwceP
	 a1J/GQX/kBfauvETvlcUaDYWygxr9nD+XseUTIf2rtVAcO8qnsl9r1/JHDTi2SAFmzU5P
	 XnOXxW8Qepey0q3ta2j16YHv4xWroKROygMc5+qRWaCHVde+H18O6s2kY/2bDpWH7BwDZ
	 paxToe2TMtnh77fTo3KIat9Xq7TXdreM8yNWKYBw/1+2iKEXTq0y3jhk1vzwXZ9rVzA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793065133;
	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=Z5R2y4WIB6GYJwGdw7y2Iv9L7vI0mR86YCmyG3VujCs=;
	b=R4GiKhrQxM+nT1uLpYvfbrJkFo3Dx774EL0QP7jTMQYUnlddR9pgE2p4X02Wf/iDCbi8
	 h/COQYQzc6LpT4VMFDDUlSYlLlV+9DZdwO0S+eJGySczwYOf6/X5LbfaE0AdU5m8C0XtR
	 Ad0UU5Czj74hX1ortuLe8bFIgEd+2yLwQryi6yiqSVgmYX4nbt2+OUIrQoR4GdkC2Xggd
	 ZQ2jGCMlAHKXpokSa4s63gnMV+ZCXFj8zKm7Ci2irDIvnBeeiqjmjdGyqi5WBUoM7OYCq
	 UZvJR1eGc4J1g6i/1mZmjs6UJcPBSNfSTcf6R40v5cAYdBdGsrWTQi7xEHeQZyRaC1g==
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="ZHlNrt/e";
	arc=none smtp.remote-ip=95.215.58.207
X-Received: from mta1.migadu.com (out-207.mta1.migadu.com [95.215.58.207])
	(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 6AD33606A31D
	for <netdev@vger.kernel.org>; Tue, 27 Oct 2026 01:38:46 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6AD33606A31D
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=zauBrSfUPWo8ed8MLMF8MB5SQEZTdd6mcbUfIXqE0Uw=;
 c=simple/simple; d=linux.dev;
 h=from:to:subject:date:message-id:mime-version:content-type; s=key1;
 t=1793065124; v=1; x=1793669924;
 b=ZHlNrt/eTVvTSj22xmTXSm4cJzYDnJT40bh2aIZLadxDLvZv6iFo0zzyQpGrX5AuLmdMzFX6
 Emk1xietszqBk9+qmXWhXALZpg5mbtRH/JnIStdwdprfHgRSjtd6NTbggR7FbNnYmQTP7cmlNsa
 iUiSB5r/6ep2ho+1iOvP7Hlw=
X-Envelope-To: netdev@vger.kernel.org
X-Received: by mta10.migadu.com with ESMTPS id 1ddee2693febae24;
	Tue, 27 Oct 2026 01:38:44 +0000
X-Mizu-Trace-ID: 1ddee2693febae24
X-Migadu-Flow: FLOW_OUT
X-Cc: Zhou Qiuyue <n0ps1edzz@gmail.com>, netdev@vger.kernel.org,
	David Ahern <dsahern@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: <at9sKRSEJLVGj9OK@kwain>