mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 04:37:32 -04:00
bpf: Use user_path_at for path resolution in uprobe_multi
Resolve the uprobe_multi user path with user_path_at() instead of copying the string with strndup_user() and passing it to kern_path(). This removes the temporary allocation and keeps the lookup logic in one helper. Signed-off-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/r/20260611114230.950379-3-jolsa@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
committed by
Alexei Starovoitov
parent
4d87a251d4
commit
65d81609e9
@@ -3227,7 +3227,6 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
|
||||
unsigned long size;
|
||||
u32 flags, cnt, i;
|
||||
struct path path;
|
||||
char *name;
|
||||
pid_t pid;
|
||||
int err;
|
||||
|
||||
@@ -3272,14 +3271,7 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
|
||||
!access_ok(ucookies, size))
|
||||
return -EFAULT;
|
||||
|
||||
name = strndup_user(upath, PATH_MAX);
|
||||
if (IS_ERR(name)) {
|
||||
err = PTR_ERR(name);
|
||||
return err;
|
||||
}
|
||||
|
||||
err = kern_path(name, LOOKUP_FOLLOW, &path);
|
||||
kfree(name);
|
||||
err = user_path_at(AT_FDCWD, upath, LOOKUP_FOLLOW, &path);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user