public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net/sched: act_ife: avoid possible NULL deref
@ 2026-01-21 13:37 Eric Dumazet
  2026-01-21 15:35 ` Jamal Hadi Salim
  2026-01-22 16:10 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2026-01-21 13:37 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, Jamal Hadi Salim, Cong Wang, Jiri Pirko, netdev,
	eric.dumazet, Eric Dumazet, syzbot+5cf914f193dffde3bd3c,
	Yotam Gigi

tcf_ife_encode() must make sure ife_encode() does not return NULL.

syzbot reported:

Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
 RIP: 0010:ife_tlv_meta_encode+0x41/0xa0 net/ife/ife.c:166
CPU: 3 UID: 0 PID: 8990 Comm: syz.0.696 Not tainted syzkaller #0 PREEMPT(full)
Call Trace:
 <TASK>
  ife_encode_meta_u32+0x153/0x180 net/sched/act_ife.c:101
  tcf_ife_encode net/sched/act_ife.c:841 [inline]
  tcf_ife_act+0x1022/0x1de0 net/sched/act_ife.c:877
  tc_act include/net/tc_wrapper.h:130 [inline]
  tcf_action_exec+0x1c0/0xa20 net/sched/act_api.c:1152
  tcf_exts_exec include/net/pkt_cls.h:349 [inline]
  mall_classify+0x1a0/0x2a0 net/sched/cls_matchall.c:42
  tc_classify include/net/tc_wrapper.h:197 [inline]
  __tcf_classify net/sched/cls_api.c:1764 [inline]
  tcf_classify+0x7f2/0x1380 net/sched/cls_api.c:1860
  multiq_classify net/sched/sch_multiq.c:39 [inline]
  multiq_enqueue+0xe0/0x510 net/sched/sch_multiq.c:66
  dev_qdisc_enqueue+0x45/0x250 net/core/dev.c:4147
  __dev_xmit_skb net/core/dev.c:4262 [inline]
  __dev_queue_xmit+0x2998/0x46c0 net/core/dev.c:4798

Fixes: 295a6e06d21e ("net/sched: act_ife: Change to use ife module")
Reported-by: syzbot+5cf914f193dffde3bd3c@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/6970d61d.050a0220.706b.0010.GAE@google.com/T/#u
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Yotam Gigi <yotam.gi@gmail.com>
---
 net/sched/act_ife.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
index 1dfdda6c2d4c51feb3f9db4e26e72c8e4a515687..8e8f6af731d51cd38cb469e4351a7c861fc6754b 100644
--- a/net/sched/act_ife.c
+++ b/net/sched/act_ife.c
@@ -821,6 +821,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
 	/* could be stupid policy setup or mtu config
 	 * so lets be conservative.. */
 	if ((action == TC_ACT_SHOT) || exceed_mtu) {
+drop:
 		qstats_drop_inc(this_cpu_ptr(ife->common.cpu_qstats));
 		return TC_ACT_SHOT;
 	}
@@ -829,6 +830,8 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
 		skb_push(skb, skb->dev->hard_header_len);
 
 	ife_meta = ife_encode(skb, metalen);
+	if (!ife_meta)
+		goto drop;
 
 	spin_lock(&ife->tcf_lock);
 
@@ -844,8 +847,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
 		if (err < 0) {
 			/* too corrupt to keep around if overwritten */
 			spin_unlock(&ife->tcf_lock);
-			qstats_drop_inc(this_cpu_ptr(ife->common.cpu_qstats));
-			return TC_ACT_SHOT;
+			goto drop;
 		}
 		skboff += err;
 	}
-- 
2.52.0.457.g6b5491de43-goog


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

* Re: [PATCH net] net/sched: act_ife: avoid possible NULL deref
  2026-01-21 13:37 [PATCH net] net/sched: act_ife: avoid possible NULL deref Eric Dumazet
@ 2026-01-21 15:35 ` Jamal Hadi Salim
  2026-01-22 16:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jamal Hadi Salim @ 2026-01-21 15:35 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
	Cong Wang, Jiri Pirko, netdev, eric.dumazet,
	syzbot+5cf914f193dffde3bd3c, Yotam Gigi

On Wed, Jan 21, 2026 at 8:37 AM Eric Dumazet <edumazet@google.com> wrote:
>
> tcf_ife_encode() must make sure ife_encode() does not return NULL.
>
> syzbot reported:
>
> Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN NOPTI
> KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
>  RIP: 0010:ife_tlv_meta_encode+0x41/0xa0 net/ife/ife.c:166
> CPU: 3 UID: 0 PID: 8990 Comm: syz.0.696 Not tainted syzkaller #0 PREEMPT(full)
> Call Trace:
>  <TASK>
>   ife_encode_meta_u32+0x153/0x180 net/sched/act_ife.c:101
>   tcf_ife_encode net/sched/act_ife.c:841 [inline]
>   tcf_ife_act+0x1022/0x1de0 net/sched/act_ife.c:877
>   tc_act include/net/tc_wrapper.h:130 [inline]
>   tcf_action_exec+0x1c0/0xa20 net/sched/act_api.c:1152
>   tcf_exts_exec include/net/pkt_cls.h:349 [inline]
>   mall_classify+0x1a0/0x2a0 net/sched/cls_matchall.c:42
>   tc_classify include/net/tc_wrapper.h:197 [inline]
>   __tcf_classify net/sched/cls_api.c:1764 [inline]
>   tcf_classify+0x7f2/0x1380 net/sched/cls_api.c:1860
>   multiq_classify net/sched/sch_multiq.c:39 [inline]
>   multiq_enqueue+0xe0/0x510 net/sched/sch_multiq.c:66
>   dev_qdisc_enqueue+0x45/0x250 net/core/dev.c:4147
>   __dev_xmit_skb net/core/dev.c:4262 [inline]
>   __dev_queue_xmit+0x2998/0x46c0 net/core/dev.c:4798
>
> Fixes: 295a6e06d21e ("net/sched: act_ife: Change to use ife module")
> Reported-by: syzbot+5cf914f193dffde3bd3c@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/netdev/6970d61d.050a0220.706b.0010.GAE@google.com/T/#u
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Yotam Gigi <yotam.gi@gmail.com>
> ---
>  net/sched/act_ife.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/sched/act_ife.c b/net/sched/act_ife.c
> index 1dfdda6c2d4c51feb3f9db4e26e72c8e4a515687..8e8f6af731d51cd38cb469e4351a7c861fc6754b 100644
> --- a/net/sched/act_ife.c
> +++ b/net/sched/act_ife.c
> @@ -821,6 +821,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
>         /* could be stupid policy setup or mtu config
>          * so lets be conservative.. */
>         if ((action == TC_ACT_SHOT) || exceed_mtu) {
> +drop:
>                 qstats_drop_inc(this_cpu_ptr(ife->common.cpu_qstats));
>                 return TC_ACT_SHOT;
>         }
> @@ -829,6 +830,8 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
>                 skb_push(skb, skb->dev->hard_header_len);
>
>         ife_meta = ife_encode(skb, metalen);
> +       if (!ife_meta)
> +               goto drop;
>
>         spin_lock(&ife->tcf_lock);
>
> @@ -844,8 +847,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
>                 if (err < 0) {
>                         /* too corrupt to keep around if overwritten */
>                         spin_unlock(&ife->tcf_lock);
> -                       qstats_drop_inc(this_cpu_ptr(ife->common.cpu_qstats));
> -                       return TC_ACT_SHOT;
> +                       goto drop;
>                 }
>                 skboff += err;
>         }

Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

> 2.52.0.457.g6b5491de43-goog
>

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

* Re: [PATCH net] net/sched: act_ife: avoid possible NULL deref
  2026-01-21 13:37 [PATCH net] net/sched: act_ife: avoid possible NULL deref Eric Dumazet
  2026-01-21 15:35 ` Jamal Hadi Salim
@ 2026-01-22 16:10 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-22 16:10 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: davem, kuba, pabeni, horms, jhs, xiyou.wangcong, jiri, netdev,
	eric.dumazet, syzbot+5cf914f193dffde3bd3c, yotam.gi

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 21 Jan 2026 13:37:24 +0000 you wrote:
> tcf_ife_encode() must make sure ife_encode() does not return NULL.
> 
> syzbot reported:
> 
> Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] SMP KASAN NOPTI
> KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
>  RIP: 0010:ife_tlv_meta_encode+0x41/0xa0 net/ife/ife.c:166
> CPU: 3 UID: 0 PID: 8990 Comm: syz.0.696 Not tainted syzkaller #0 PREEMPT(full)
> Call Trace:
>  <TASK>
>   ife_encode_meta_u32+0x153/0x180 net/sched/act_ife.c:101
>   tcf_ife_encode net/sched/act_ife.c:841 [inline]
>   tcf_ife_act+0x1022/0x1de0 net/sched/act_ife.c:877
>   tc_act include/net/tc_wrapper.h:130 [inline]
>   tcf_action_exec+0x1c0/0xa20 net/sched/act_api.c:1152
>   tcf_exts_exec include/net/pkt_cls.h:349 [inline]
>   mall_classify+0x1a0/0x2a0 net/sched/cls_matchall.c:42
>   tc_classify include/net/tc_wrapper.h:197 [inline]
>   __tcf_classify net/sched/cls_api.c:1764 [inline]
>   tcf_classify+0x7f2/0x1380 net/sched/cls_api.c:1860
>   multiq_classify net/sched/sch_multiq.c:39 [inline]
>   multiq_enqueue+0xe0/0x510 net/sched/sch_multiq.c:66
>   dev_qdisc_enqueue+0x45/0x250 net/core/dev.c:4147
>   __dev_xmit_skb net/core/dev.c:4262 [inline]
>   __dev_queue_xmit+0x2998/0x46c0 net/core/dev.c:4798
> 
> [...]

Here is the summary with links:
  - [net] net/sched: act_ife: avoid possible NULL deref
    https://git.kernel.org/netdev/net/c/27880b0b0d35

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] 3+ messages in thread

end of thread, other threads:[~2026-01-22 16:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-21 13:37 [PATCH net] net/sched: act_ife: avoid possible NULL deref Eric Dumazet
2026-01-21 15:35 ` Jamal Hadi Salim
2026-01-22 16:10 ` 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