]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
net/sched: act_bpf: use rcu_dereference_bh() to read the filter
authorSechang Lim <rhkrqnwk98@gmail.com>
Mon, 29 Jun 2026 15:41:06 +0000 (15:41 +0000)
committerJakub Kicinski <kuba@kernel.org>
Wed, 1 Jul 2026 01:27:26 +0000 (18:27 -0700)
commitadc49c7ba690c9b33b8392ec27397456b65d0893
tree16885d4208c59f75451367b50355a97e37be247e
parent2f7f2e311106cb838d3f3fb6ef25effdb3f8e366
net/sched: act_bpf: use rcu_dereference_bh() to read the filter

tcf_bpf_act() can run from the tc egress path, which holds only
rcu_read_lock_bh(), but reads prog->filter with rcu_dereference() and
trips lockdep:

  WARNING: suspicious RCU usage
  net/sched/act_bpf.c:47 suspicious rcu_dereference_check() usage!
  1 lock held by syz.2.1588/12756:
   #0: (rcu_read_lock_bh){....}-{1:3}, at: __dev_queue_xmit net/core/dev.c:4792
   tcf_bpf_act+0x6ae/0x940 net/sched/act_bpf.c:47
   tcf_classify+0x6e4/0x1080 net/sched/cls_api.c:1860
   sch_handle_egress net/core/dev.c:4545 [inline]
   __dev_queue_xmit+0x2185/0x2c00 net/core/dev.c:4808
   packet_sendmsg+0x3dfa/0x5120 net/packet/af_packet.c:3114

The other tc actions and cls_bpf already use rcu_dereference_bh() here.
Do the same.

Fixes: 1f211a1b929c ("net, sched: add clsact qdisc")
Signed-off-by: Sechang Lim <rhkrqnwk98@gmail.com>
Reviewed-by: Amery Hung <ameryhung@gmail.com>
Link: https://patch.msgid.link/20260629154112.1164986-1-rhkrqnwk98@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/sched/act_bpf.c