Skip to contentSkip to conversation

bpf: Fix uprobe_multi get_pid_task error path

PATCH Applied Jiri Olsa 3 participants 3 messages Sep 15, 2023

Subsystems (4)
lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

PATCH 1/1 bpf: Fix uprobe_multi get_pid_task error path

Dan reported Smatch static checker warning due to missing error value set in uprobe multi link's get_pid_task error path.

---
 kernel/trace/bpf_trace.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/bpf_trace.c +3 -1
index c1c1af63ced2..868008f56fec 100644
@@ -3223,8 +3223,10 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
 		rcu_read_lock();
 		task = get_pid_task(find_vpid(pid), PIDTYPE_PID);
 		rcu_read_unlock();
-		if (!task)
+		if (!task) {
+			err = -ESRCH;
 			goto error_path_put;
+		}
 	}
 
 	err = -ENOMEM;
Signature · 1 line
2.41.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jiri Olsa

Dan reported Smatch static checker warning due to missing error value set in uprobe multi link's get_pid_task error path.

Quoted 24 lines
---
 kernel/trace/bpf_trace.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/trace/bpf_trace.c +3 -2
index c1c1af63ced2..868008f56fec 100644
@@ -3223,8 +3223,10 @@ int bpf_uprobe_multi_link_attach(const union bpf_attr *attr, struct bpf_prog *pr
                rcu_read_lock();
                task = get_pid_task(find_vpid(pid), PIDTYPE_PID);
                rcu_read_unlock();
-               if (!task)
+               if (!task) {
+                       err = -ESRCH;
                        goto error_path_put;
+               }
        }
 
        err = -ENOMEM;
--

2.41.0

#2 lore raw
In reply to Jiri Olsa
This patch was applied to bpf/bpf.git (master) by Alexei Starovoitov <[email protected]>:

Hello:

This patch was applied to bpf/bpf.git (master)
by Alexei Starovoitov <[email protected]>:

Quoted 8 lines · On Fri, 15 Sep 2023 12:14:20 +0200 you wrote:

Dan reported Smatch static checker warning due to missing error value set in uprobe multi link's get_pid_task error path.

[...]

Here is the summary with links:
- [bpf] bpf: Fix uprobe_multi get_pid_task error path

    https://git.kernel.org/bpf/bpf/c/57eb5e1c5c57

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html