From: Stanislav Fomichev <stfomichev@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org, eric.dumazet@gmail.com,
syzbot+0c7bfd8cf3aecec92708@syzkaller.appspotmail.com
Subject: Re: [PATCH net-next] bpf: fix a possible NULL deref in bpf_map_offload_map_alloc()
Date: Fri, 7 Mar 2025 07:21:54 -0800 [thread overview]
Message-ID: <Z8sPEqJ55AX7qKWN@mini-arch> (raw)
In-Reply-To: <20250307074303.1497911-1-edumazet@google.com>
On 03/07, Eric Dumazet wrote:
> Call bpf_dev_offload_check() before netdev_lock_ops().
>
> This is needed if attr->map_ifindex is not valid.
>
> Oops: general protection fault, probably for non-canonical address 0xdffffc0000000197: 0000 [#1] PREEMPT SMP KASAN PTI
> KASAN: null-ptr-deref in range [0x0000000000000cb8-0x0000000000000cbf]
> RIP: 0010:netdev_need_ops_lock include/linux/netdevice.h:2792 [inline]
> RIP: 0010:netdev_lock_ops include/linux/netdevice.h:2803 [inline]
> RIP: 0010:bpf_map_offload_map_alloc+0x19a/0x910 kernel/bpf/offload.c:533
> Call Trace:
> <TASK>
> map_create+0x946/0x11c0 kernel/bpf/syscall.c:1455
> __sys_bpf+0x6d3/0x820 kernel/bpf/syscall.c:5777
> __do_sys_bpf kernel/bpf/syscall.c:5902 [inline]
> __se_sys_bpf kernel/bpf/syscall.c:5900 [inline]
> __x64_sys_bpf+0x7c/0x90 kernel/bpf/syscall.c:5900
> do_syscall_x64 arch/x86/entry/common.c:52 [inline]
> do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83
>
> Fixes: 97246d6d21c2 ("net: hold netdev instance lock during ndo_bpf")
> Reported-by: syzbot+0c7bfd8cf3aecec92708@syzkaller.appspotmail.com
> Closes: https://lore.kernel.org/netdev/67caa2b1.050a0220.15b4b9.0077.GAE@google.com/T/#u
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Oops, thanks for a quick fix!
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
next prev parent reply other threads:[~2025-03-07 15:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-07 7:43 [PATCH net-next] bpf: fix a possible NULL deref in bpf_map_offload_map_alloc() Eric Dumazet
2025-03-07 15:21 ` Stanislav Fomichev [this message]
2025-03-08 3:40 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z8sPEqJ55AX7qKWN@mini-arch \
--to=stfomichev@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=syzbot+0c7bfd8cf3aecec92708@syzkaller.appspotmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.