net/sched: act_mirred: Fix leak when redirecting to self on egress
authorJamal Hadi Salim <jhs@mojatatu.com>
Thu, 1 Jan 2026 13:56:07 +0000 (08:56 -0500)
committerJakub Kicinski <kuba@kernel.org>
Tue, 6 Jan 2026 00:23:42 +0000 (16:23 -0800)
commit9892353726ad222219aa18c329e3a3636134dd56
tree3ffd4a133b5bd3daed14d20cf4d7b324b4669d42
parentd96bfb686742a8b11cca3fca299ff9fe307ca5a9
net/sched: act_mirred: Fix leak when redirecting to self on egress

Whenever a mirred redirect to self on egress happens, mirred allocates a
new skb (skb_to_send). The loop to self check was done after that
allocation, but was not freeing the newly allocated skb, causing a leak.

Fix this by moving the if-statement to before the allocation of the new
skb.

The issue was found by running the accompanying tdc test in 2/2
with config kmemleak enabled.
After a few minutes the kmemleak thread ran and reported the leak coming from
mirred.

Fixes: 1d856251a009 ("net/sched: act_mirred: fix loop detection")
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Link: https://patch.msgid.link/20260101135608.253079-2-jhs@mojatatu.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/sched/act_mirred.c