Skip to content

Commit 9883ef0

Browse files
edumazetUlrich Hecht
authored andcommitted
net/sched: act_ife: avoid possible NULL deref
[ Upstream commit 27880b0b0d35ad1c98863d09788254e36f874968 ] 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: 295a6e0 ("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> Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com> Link: https://patch.msgid.link/20260121133724.3400020-1-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent 076db72 commit 9883ef0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

net/sched/act_ife.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
795795
/* could be stupid policy setup or mtu config
796796
* so lets be conservative.. */
797797
if ((action == TC_ACT_SHOT) || exceed_mtu) {
798+
drop:
798799
qstats_drop_inc(this_cpu_ptr(ife->common.cpu_qstats));
799800
return TC_ACT_SHOT;
800801
}
@@ -803,6 +804,8 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
803804
skb_push(skb, skb->dev->hard_header_len);
804805

805806
ife_meta = ife_encode(skb, metalen);
807+
if (!ife_meta)
808+
goto drop;
806809

807810
spin_lock(&ife->tcf_lock);
808811

@@ -818,8 +821,7 @@ static int tcf_ife_encode(struct sk_buff *skb, const struct tc_action *a,
818821
if (err < 0) {
819822
/* too corrupt to keep around if overwritten */
820823
spin_unlock(&ife->tcf_lock);
821-
qstats_drop_inc(this_cpu_ptr(ife->common.cpu_qstats));
822-
return TC_ACT_SHOT;
824+
goto drop;
823825
}
824826
skboff += err;
825827
}

0 commit comments

Comments
 (0)