Netdev List
 help / color / mirror / Atom feed
* [PATCH] net/sched: act_api: avoid dereferencing ERR_PTR in tcf_idrinfo_destroy
@ 2026-01-02 23:21 Shivani Gupta
  2026-01-04  4:09 ` Cong Wang
  2026-01-05  0:59 ` [PATCH v2] " Shivani Gupta
  0 siblings, 2 replies; 4+ messages in thread
From: Shivani Gupta @ 2026-01-02 23:21 UTC (permalink / raw)
  To: netdev
  Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
	Shivani Gupta, syzbot+8f1c492ffa4644ff3826

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.

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>
---
 net/sched/act_api.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index ff6be5cfe2b0..994f7ffe26a5 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -940,6 +940,10 @@ 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)) {
+			WARN_ON_ONCE(1);
+			continue;
+		}
 		if (tc_act_in_hw(p) && !mutex_taken) {
 			rtnl_lock();
 			mutex_taken = true;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-01-07  1:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-02 23:21 [PATCH] net/sched: act_api: avoid dereferencing ERR_PTR in tcf_idrinfo_destroy Shivani Gupta
2026-01-04  4:09 ` Cong Wang
2026-01-05  0:59 ` [PATCH v2] " Shivani Gupta
2026-01-07  1:40   ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox