]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net/sched: act_api: avoid dereferencing ERR_PTR in tcf_idrinfo_destroy
authorShivani Gupta <shivani07g@gmail.com>
Mon, 5 Jan 2026 00:59:05 +0000 (00:59 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 7 Jan 2026 01:27:18 +0000 (17:27 -0800)
syzbot reported a crash in tc_act_in_hw() during netns teardown where
tcf_idrinfo_destroy() passed an ERR_PTR(-EBUSY) value as a tc_action
pointer, leading to an invalid dereference.

Guard against ERR_PTR entries when iterating the action IDR so teardown
does not call tc_act_in_hw() on an error pointer.

Fixes: 84a7d6797e6a ("net/sched: acp_api: no longer acquire RTNL in tc_action_net_exit()")
Link: https://syzkaller.appspot.com/bug?extid=8f1c492ffa4644ff3826
Reported-by: syzbot+8f1c492ffa4644ff3826@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=8f1c492ffa4644ff3826
Signed-off-by: Shivani Gupta <shivani07g@gmail.com>
Link: https://patch.msgid.link/20260105005905.243423-1-shivani07g@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/sched/act_api.c

index ff6be5cfe2b0503a46a7cc8d657437fca6d0dac7..e1ab0faeb8113efd35d81aea9cfc21723dd6b3e9 100644 (file)
@@ -940,6 +940,8 @@ void tcf_idrinfo_destroy(const struct tc_action_ops *ops,
        int ret;
 
        idr_for_each_entry_ul(idr, p, tmp, id) {
+               if (IS_ERR(p))
+                       continue;
                if (tc_act_in_hw(p) && !mutex_taken) {
                        rtnl_lock();
                        mutex_taken = true;