From: Stanislav Fomichev Date: Mon, 31 Mar 2025 14:28:14 +0000 (-0700) Subject: bpf: add missing ops lock around dev_xdp_attach_link X-Git-Tag: v6.15-rc1~19^2~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d996e412b2dfc079bd44bff5b3bc743fdb6d7c90;p=thirdparty%2Fkernel%2Flinux.git bpf: add missing ops lock around dev_xdp_attach_link Syzkaller points out that create_link path doesn't grab ops lock, add it. Reported-by: syzbot+08936936fe8132f91f1a@syzkaller.appspotmail.com Closes: https://lore.kernel.org/bpf/67e6b3e8.050a0220.2f068f.0079.GAE@google.com/ Fixes: 97246d6d21c2 ("net: hold netdev instance lock during ndo_bpf") Signed-off-by: Stanislav Fomichev Link: https://patch.msgid.link/20250331142814.1887506-1-sdf@fomichev.me Signed-off-by: Jakub Kicinski --- diff --git a/net/core/dev.c b/net/core/dev.c index be17e0660144f..5d20ff226d5e7 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -10284,7 +10284,9 @@ int bpf_xdp_link_attach(const union bpf_attr *attr, struct bpf_prog *prog) goto unlock; } + netdev_lock_ops(dev); err = dev_xdp_attach_link(dev, &extack, link); + netdev_unlock_ops(dev); rtnl_unlock(); if (err) {