From: Jakub Kicinski kuba@kernel.org
mainline inclusion from mainline-v6.8-rc6 commit 166c2c8a6a4dc2e4ceba9e10cfe81c3e469e3210 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9E2LZ CVE: CVE-2024-26739
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
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
Conflicts: net/sched/act_mirred.c
Signed-off-by: Zhengchao Shao shaozhengchao@huawei.com --- net/sched/act_mirred.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c index 91a19460cb57..97a4a1fc7c4e 100644 --- a/net/sched/act_mirred.c +++ b/net/sched/act_mirred.c @@ -323,15 +323,18 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a, }
err = tcf_mirred_forward(want_ingress, skb2); - if (err) { -out: + if (err) tcf_action_inc_overlimit_qstats(&m->common); - if (tcf_mirred_is_act_redirect(m_eaction)) - retval = TC_ACT_SHOT; - } __this_cpu_dec(mirred_nest_level);
return retval; + +out: + tcf_action_inc_overlimit_qstats(&m->common); + if (tcf_mirred_is_act_redirect(m_eaction)) + retval = TC_ACT_SHOT; + __this_cpu_dec(mirred_nest_level); + return retval; }
static void tcf_stats_update(struct tc_action *a, u64 bytes, u64 packets,
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,转换为PR失败! 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/J... 失败原因:应用补丁/补丁集失败,Patch failed at 0001 net/sched: act_mirred: don't override retval if we already lost the skb 建议解决方法:请查看失败原因, 确认补丁是否可以应用在当前期望分支的最新代码上
FeedBack: The patch(es) which you have sent to kernel@openeuler.org has been converted to PR failed! Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/J... Failed Reason: apply patch(es) failed, Patch failed at 0001 net/sched: act_mirred: don't override retval if we already lost the skb Suggest Solution: please checkout if the failed patch(es) can work on the newest codes in expected branch