* [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* Re: [PATCH] net/sched: act_api: avoid dereferencing ERR_PTR in tcf_idrinfo_destroy
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
1 sibling, 0 replies; 4+ messages in thread
From: Cong Wang @ 2026-01-04 4:09 UTC (permalink / raw)
To: Shivani Gupta
Cc: netdev, Jamal Hadi Salim, Jiri Pirko, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
syzbot+8f1c492ffa4644ff3826
On Fri, Jan 02, 2026 at 11:21:16PM +0000, Shivani Gupta wrote:
> 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>
Thanks for the patch, Shivani.
Could you provide a Fixes tag for this while you are on it?
> ---
> 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);
Hm, I guess we should remove this warning here since ERR_PTR is expected
in some corner case?
Regards,
Cong Wang
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH v2] net/sched: act_api: avoid dereferencing ERR_PTR in tcf_idrinfo_destroy
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 ` Shivani Gupta
2026-01-07 1:40 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 4+ messages in thread
From: Shivani Gupta @ 2026-01-05 0:59 UTC (permalink / raw)
To: netdev
Cc: Jamal Hadi Salim, Cong Wang, Jiri Pirko, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
syzbot+8f1c492ffa4644ff3826, Shivani Gupta
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>
---
v2:
- Drop WARN_ON_ONCE() as ERR_PTR can be expected in a corner case.
- Add Fixes: tag.
net/sched/act_api.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index ff6be5cfe2b0..5e0a196ce66a 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -940,6 +940,9 @@ 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;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH v2] net/sched: act_api: avoid dereferencing ERR_PTR in tcf_idrinfo_destroy
2026-01-05 0:59 ` [PATCH v2] " Shivani Gupta
@ 2026-01-07 1:40 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-07 1:40 UTC (permalink / raw)
To: Shivani Gupta
Cc: netdev, jhs, xiyou.wangcong, jiri, davem, edumazet, kuba, pabeni,
horms, syzbot+8f1c492ffa4644ff3826
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 5 Jan 2026 00:59:05 +0000 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- [v2] net/sched: act_api: avoid dereferencing ERR_PTR in tcf_idrinfo_destroy
https://git.kernel.org/netdev/net/c/adb25a46dc0a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [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