Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=62.96.220.36 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796129048; b=b7N4bDSyqjH4g2hM4hLGsP06aFP7eDTs7DxgDPQWp9WjYv1dPleGvmcJwawf6tU4mdh0 DK2DjDdE3thmRuQ9m9ZBe8Ih1/I9x5qykfRfmeALmpcZ3sFhP/by1vJbJrp61SAjtBT0r MXScdgg7vRMM/UvcIbN/sBFH7X9M5fPXQS2yLqtpWfElx0vr0ZyoTARHZJQBMDdOyn7LZ 8SgkDmL4A+vwhdCrJ2fqZ+rCA2e1YR1aLUQKv9hzx42oWZ7naOL4yVJ37ejsin7WIu0cQ lZyST1gA39qGHKlOqwrBae/K50dtatIPmmgsy5hSKEO+B25O/ms+wztdCJ5CIjFLvDQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796129048; h=DMARC-Filter:Received:X-Virus-Scanned:Received:Received:DKIM-Filter: DKIM-Signature:Received:Received:From:To:CC:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:Content-Type:X-ClientProxiedBy; bh=ghTBPr6KAR++h8XkmhxStVjzFmJ8e6YTFMBn4ML3CEs=; b=qmKIZ37Rl8ZNSXkZsNx0gdnDZ101w0OtJifZWUlms9iB3SL4wTTghh3h/muM0tMZdM3k byL5JAryf6WDyfShlpOHM1n6fxucF4BcSpLKtuzlZmbagD3KyJlrH+9RoBNtJfcUx2Zvz 5xcgnhTsL8v7707z1t8wDuJRKPXWdDUaNC6qSyFnKIin+Bauh8rrruSblkARHVURendKD 5WpXjWRMmzrVLkz/Ku3ju/TsiHtGc7A++njlWP9XaCBFrwnGLdB0vWhKd3qj9jbCrRYar tf8PGIXd/jj7o68VKkAqLi9awOHvqfwtbnKElSslF2WzzoK9ZfxyrvefX15eQEW3EAw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=secunet.com; spf=pass smtp.mailfrom=secunet.com; dkim=pass header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b="j//wziOP"; arc=none smtp.remote-ip=62.96.220.36 Received: from mx1.secunet.com (mx1.secunet.com [62.96.220.36]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CA9A606A696 for ; Tue, 1 Dec 2026 12:44:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1CA9A606A696 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=secunet.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=secunet.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=secunet.com header.i=@secunet.com header.a=rsa-sha256 header.s=202301 header.b=j//wziOP Received: from localhost (localhost [127.0.0.1]) by mx1.secunet.com (Postfix) with ESMTP id BC8B8207FC; Tue, 1 Dec 2026 13:44:06 +0100 (CET) X-Virus-Scanned: by secunet Received: from mx1.secunet.com ([127.0.0.1]) by localhost (mx1.secunet.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id st1IO7tMblH8; Tue, 1 Dec 2026 13:44:05 +0100 (CET) Received: from EXCH-01.secunet.de (rl1.secunet.de [10.32.0.231]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.secunet.com (Postfix) with ESMTPS id D6601204D9; Tue, 1 Dec 2026 13:44:05 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.secunet.com D6601204D9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=secunet.com; s=202301; t=1796129045; bh=ghTBPr6KAR++h8XkmhxStVjzFmJ8e6YTFMBn4ML3CEs=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=j//wziOPsR61uIEfd62gyq210HKu1caprGWA57PGxbxJTQUeDWUpHUywywjuCXmnf UTSTFcCstkVmX1m+IvFe71ghxfV4omkQkyjOClp/wL2iJuZizeDRGbez/AGr6Dejq6 rY/LIc35bWAXYfFKcZUkA6/Y/FyNX3fWi5pbGxqM2In+eZ0YfXFwVtzoA8ab1uoxZG fe84QDQx4ErwWjtaW6CXWn++Q1GVQwzHSAnAUmQlX8URxMvlO2DDFh4yon826iYrl9 iJlggIfYQJDGd4YZD2pyGZIHDcEPULM965gfvpQ3ejwuW0J2CkHed2VsTN4eylQ8Mu ovJfRg9mLWa0A== Received: from gauss4 (10.182.7.102) by EXCH-01.secunet.de (10.32.0.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Tue, 1 Dec 2026 13:44:05 +0100 Received: (nullmailer pid 1165806 invoked by uid 1000); Tue, 01 Dec 2026 12:43:56 -0000 From: Steffen Klassert To: David Miller , Jakub Kicinski CC: Herbert Xu , Steffen Klassert , Subject: [PATCH 13/22] xfrm: iptfs: force a dst reference before queueing an skb Date: Tue, 1 Dec 2026 13:41:39 +0100 Message-ID: <20261201124252.1163254-14-steffen.klassert@secunet.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261201124252.1163254-1-steffen.klassert@secunet.com> References: <20261201124252.1163254-1-steffen.klassert@secunet.com> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EXCH-02.secunet.de (10.32.0.172) To EXCH-01.secunet.de (10.32.0.171) From: Nguyen Ngoc Thang iptfs_output_collect() is the dst->output hook and runs under the caller's RCU read lock. It queues the skb and sends it later from the iptfs hrtimer. The skb may still carry a noref dst, e.g. one set by __ip_queue_xmit() via skb_dst_set_noref(). Once the RCU section ends, nothing keeps that dst alive. When the timer fires, xfrm_output_one() calls skb_dst_force() outside any RCU section: WARNING: include/net/dst.h:326 at xfrm_output_resume+0x41d9/0x64e0 Call Trace: xfrm_output_one net/xfrm/xfrm_output.c:549 [inline] xfrm_output_resume+0x41d9/0x64e0 net/xfrm/xfrm_output.c:597 iptfs_output_queued net/xfrm/xfrm_iptfs.c:2325 [inline] iptfs_delay_timer+0x3803/0x4310 net/xfrm/xfrm_iptfs.c:2362 __run_hrtimer kernel/time/hrtimer.c [inline] __hrtimer_run_queues+0x3bc/0xa10 kernel/time/hrtimer.c hrtimer_run_softirq+0x1e3/0x2e0 kernel/time/hrtimer.c:2153 handle_softirqs+0x265/0x8d0 kernel/softirq.c:669 The warning also means the queued skb may point to a dst that has already been freed. Take a reference with skb_dst_force() while still under RCU, as other deferred xmit paths do, and drop the skb if its dst is already gone. Fixes: 0e4fbf013fa5 ("xfrm: iptfs: add user packet (tunnel ingress) handling") Reported-by: syzbot+622de7e1f18a30fc404a@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=622de7e1f18a30fc404a Signed-off-by: Nguyen Ngoc Thang Signed-off-by: Steffen Klassert --- net/xfrm/xfrm_iptfs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/xfrm/xfrm_iptfs.c b/net/xfrm/xfrm_iptfs.c index 0313a43aa8a9..3fff835497b9 100644 --- a/net/xfrm/xfrm_iptfs.c +++ b/net/xfrm/xfrm_iptfs.c @@ -1914,6 +1914,13 @@ static int iptfs_output_collect(struct net *net, struct sock *sk, struct sk_buff continue; } + /* The queued skb outlives our RCU section, so pin its dst. */ + if (!skb_dst_force(skb)) { + XFRM_INC_STATS(net, LINUX_MIB_XFRMOUTERROR); + kfree_skb(skb); + continue; + } + /* Enqueue to send in tunnel */ ok = iptfs_enqueue(xtfs, skb); if (!ok) -- 2.53.0