diff options
| author | Anton Protopopov <a.s.protopopov@gmail.com> | 2026-02-13 21:29:49 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <ast@kernel.org> | 2026-02-13 14:37:02 -0800 |
| commit | b0b1a8583d8e797114e613139e3e3318a1704690 (patch) | |
| tree | 3530dd28f15b494ae5994daf440b340311bc8a2b /rust/alloc/collections/git@git.tavy.me:linux.git | |
| parent | de516a9167e4634cadee1e7ff13fd08e2a122bf0 (diff) | |
bpf: Add a map/btf from a fd array more consistently
The add_fd_from_fd_array() function takes a file descriptor as a
parameter and tries to add either map or btf to the corresponding
list of used objects. As was reported by Dan Carpenter, since the
commit c81e4322acf0 ("bpf: Fix a potential use-after-free of BTF
object"), the fdget() is called twice on the file descriptor, and
thus userspace, potentially, can replace the file pointed to by the
file descriptor in between the two calls. On practice, this shouldn't
break anything on the kernel side, but for consistency fix the code
such that only one fdget() is executed.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/aY689z7gHNv8rgVO@stanley.mountain/
Fixes: ccd2d799ed44 ("bpf: Fix a potential use-after-free of BTF object")
Signed-off-by: Anton Protopopov <a.s.protopopov@gmail.com>
Link: https://lore.kernel.org/r/20260213212949.759321-1-a.s.protopopov@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'rust/alloc/collections/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
