]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net/sched: act_mirred: don't override retval if we already lost the skb
authorJakub Kicinski <kuba@kernel.org>
Thu, 15 Feb 2024 14:33:46 +0000 (06:33 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 May 2025 07:39:37 +0000 (09:39 +0200)
commit9d3ef89b6a5e9f2e940de2cef3d543be0be8dec5
treeb36c5912b580e8656f474773cae9af15e197d806
parent9efb2b99b96c86664bbdbdd2cdb354ac9627eb20
net/sched: act_mirred: don't override retval if we already lost the skb

commit 166c2c8a6a4dc2e4ceba9e10cfe81c3e469e3210 upstream.

If we're redirecting the skb, and haven't called tcf_mirred_forward(),
yet, we need to tell the core to drop the skb by setting the retcode
to SHOT. If we have called tcf_mirred_forward(), however, the skb
is out of our hands and returning SHOT will lead to UaF.

Move the retval override to the error path which actually need it.

Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Fixes: e5cf1baf92cb ("act_mirred: use TC_ACT_REINSERT when possible")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
[Minor conflict resolved due to code context change.]
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
Signed-off-by: He Zhe <zhe.he@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/sched/act_mirred.c