Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793215717; b=NMWlwd/COVCA9H4am9eT4OWdntt3b/pXsVM+X/5cC1nweYeJMHbBIJW3+5HXguJ1eAPE k7Zq0I3zIZB5nuPFlZtLJA9ZQI+qP0f1+C29JYiUtx9/tf4z9Jiupf1P6WI/kY6gGEvn1 +CUddwngbEqvqEzo+Tt599SCS0xXRKOMjFoXZDYYbM6qfJP8m+JEQeX2lvuEHuA5ikh2a tMh/oT1xe2moEvy7HwvWmW0I6UO4p2gDreUTdrXkUpIHSRGCuZ0ez8N64a2nxWKDWyKOF dBU8DLK5ogave0uyylYIe/l7AQuHieEjImtGakHmDnaiSYoiuKCFDGtKqi8ASnR2kLQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793215717; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=J7zztXCZ/SENo8N/uB3BUiF1X4nindpFBOyBdIifjD0=; b=lvm7PU1nCs71oKEEcy1AlCaZtLIazA9+ldZArAF0haLVnE3bS+cuODa2ZbXr0630fIQy LkbxLanzW2bz4oWE+jMkKCkKiKOT9yGSuH5p2ZG99mTwXvb0LoJicJ8lAkSSRQ5SnFPoj Nxju1DTCpdsRhgnDxG4KmI9I+woxuPPRWtGM0cVf2QHoXqxxf1QzHvGI3lUwL9wuWee29 zg4i02Nr1OK9wc33hQQKBHY2VOD5dGHlCIXf0YbIiIdq/6jkM7MHEoso7x1empl3Yrl3n wSksDqONiPUIuI9e6RjLaCaXDhRW7SfmEK9LMW3mSPfkfYgUSm3tnOFraa7ZsHoq3Fg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Q2Hz5MVG; arc=none smtp.remote-ip=100.103.45.18 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 52480606A31A; Wed, 28 Oct 2026 19:28:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Q2Hz5MVG Received: by smtp.kernel.org (Postfix) with ESMTPSA id A29A21F01825; Wed, 28 Oct 2026 19:28:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1793215717; bh=J7zztXCZ/SENo8N/uB3BUiF1X4nindpFBOyBdIifjD0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Q2Hz5MVGgcUSXDcCy4/Oe0fYSOD5TFlbLqI6WWv36n0/djEseLbyf9tYLA+mQypB+ Nx95gqpZwLjuXaZYbsVDZMxrBZxw4rRnpIUg+F6bCgb7IHP8zCddLh7GNxvcY/qAcD MaC2XIFMmNJFzQa3347F3FGYIp4hVce5oWg9GBZo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Ido Schimmel , Jamal Hadi Salim , Simon Horman , "David S. Miller" , Sasha Levin Subject: [PATCH 6.1 1307/1887] net, sched: Fix SKB_NOT_DROPPED_YET splat under debug config Date: Wed, 28 Oct 2026 17:56:43 +0100 Message-ID: <20261028170529.174769617@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261028170459.200466217@linuxfoundation.org> References: <20261028170459.200466217@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jamal Hadi Salim [ Upstream commit 40cb2fdfed342e7e578d551a073687789f698d89 ] Getting the following splat [1] with CONFIG_DEBUG_NET=y and this reproducer [2]. Problem seems to be that classifiers clear 'struct tcf_result::drop_reason', thereby triggering the warning in __kfree_skb_reason() due to reason being 'SKB_NOT_DROPPED_YET' (0). Fixed by disambiguating a legit error from a verdict with a bogus drop_reason [1] WARNING: CPU: 0 PID: 181 at net/core/skbuff.c:1082 kfree_skb_reason+0x38/0x130 Modules linked in: CPU: 0 PID: 181 Comm: mausezahn Not tainted 6.6.0-rc6-custom-ge43e6d9582e0 #682 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-1.fc37 04/01/2014 RIP: 0010:kfree_skb_reason+0x38/0x130 [...] Call Trace: __netif_receive_skb_core.constprop.0+0x837/0xdb0 __netif_receive_skb_one_core+0x3c/0x70 process_backlog+0x95/0x130 __napi_poll+0x25/0x1b0 net_rx_action+0x29b/0x310 __do_softirq+0xc0/0x29b do_softirq+0x43/0x60 [2] ip link add name veth0 type veth peer name veth1 ip link set dev veth0 up ip link set dev veth1 up tc qdisc add dev veth1 clsact tc filter add dev veth1 ingress pref 1 proto all flower dst_mac 00:11:22:33:44:55 action drop mausezahn veth0 -a own -b 00:11:22:33:44:55 -q -c 1 Ido reported: [...] getting the following splat [1] with CONFIG_DEBUG_NET=y and this reproducer [2]. Problem seems to be that classifiers clear 'struct tcf_result::drop_reason', thereby triggering the warning in __kfree_skb_reason() due to reason being 'SKB_NOT_DROPPED_YET' (0). [...] [1] WARNING: CPU: 0 PID: 181 at net/core/skbuff.c:1082 kfree_skb_reason+0x38/0x130 Modules linked in: CPU: 0 PID: 181 Comm: mausezahn Not tainted 6.6.0-rc6-custom-ge43e6d9582e0 #682 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.2-1.fc37 04/01/2014 RIP: 0010:kfree_skb_reason+0x38/0x130 [...] Call Trace: __netif_receive_skb_core.constprop.0+0x837/0xdb0 __netif_receive_skb_one_core+0x3c/0x70 process_backlog+0x95/0x130 __napi_poll+0x25/0x1b0 net_rx_action+0x29b/0x310 __do_softirq+0xc0/0x29b do_softirq+0x43/0x60 [2] #!/bin/bash ip link add name veth0 type veth peer name veth1 ip link set dev veth0 up ip link set dev veth1 up tc qdisc add dev veth1 clsact tc filter add dev veth1 ingress pref 1 proto all flower dst_mac 00:11:22:33:44:55 action drop mausezahn veth0 -a own -b 00:11:22:33:44:55 -q -c 1 What happens is that inside most classifiers the tcf_result is copied over from a filter template e.g. *res = f->res which then implicitly overrides the prior SKB_DROP_REASON_TC_{INGRESS,EGRESS} default drop code which was set via sch_handle_{ingress,egress}() for kfree_skb_reason(). Commit text above copied verbatim from Daniel. The general idea of the patch is not very different from what Ido originally posted but instead done at the cls_api codepath. Fixes: 54a59aed395c ("net, sched: Make tc-related drop reason more flexible") Reported-by: Ido Schimmel Signed-off-by: Jamal Hadi Salim Link: https://lore.kernel.org/netdev/ZTjY959R+AFXf3Xy@shredder Reviewed-by: Simon Horman Signed-off-by: David S. Miller Stable-dep-of: f60b396ee174 ("net/sched: act_api: fix TOCTOU NULL deref on a->goto_chain") Signed-off-by: Sasha Levin --- net/sched/act_api.c | 2 +- net/sched/cls_api.c | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/net/sched/act_api.c b/net/sched/act_api.c index a24e8327e7e7b..5fd72b061801e 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c @@ -1131,7 +1131,7 @@ int tcf_action_exec(struct sk_buff *skb, struct tc_action **actions, } } else if (TC_ACT_EXT_CMP(ret, TC_ACT_GOTO_CHAIN)) { if (unlikely(!rcu_access_pointer(a->goto_chain))) { - net_warn_ratelimited("can't go to NULL chain!\n"); + tcf_set_drop_reason(res, SKB_DROP_REASON_TC_ERROR); return TC_ACT_SHOT; } tcf_action_goto_chain_exec(a, res); diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 603b7caebad2b..b79d98711e757 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -1601,6 +1601,7 @@ static inline int __tcf_classify(struct sk_buff *skb, bool compat_mode, u32 *last_executed_chain) { + u32 orig_reason = res->drop_reason; #ifdef CONFIG_NET_CLS_ACT const int max_reclassify_loop = 16; const struct tcf_proto *first_tp; @@ -1628,8 +1629,14 @@ static inline int __tcf_classify(struct sk_buff *skb, goto reset; } #endif - if (err >= 0) + if (err >= 0) { + /* Policy drop or drop reason is over-written by + * classifiers with a bogus value(0) */ + if (err == TC_ACT_SHOT && + res->drop_reason == SKB_NOT_DROPPED_YET) + tcf_set_drop_reason(res, orig_reason); return err; + } } return TC_ACT_UNSPEC; /* signal: continue lookup */ -- 2.53.0