diff mbox series

[bpf-next] bpf: Fix returned error sign when link doesn't support updates

Message ID 20200525122928.1164495-1-jakub@cloudflare.com
State Accepted
Delegated to: BPF Maintainers
Headers show
Series [bpf-next] bpf: Fix returned error sign when link doesn't support updates | expand

Commit Message

Jakub Sitnicki May 25, 2020, 12:29 p.m. UTC
System calls encode returned errors as negative values. Fix a typo that
breaks this convention for bpf(LINK_UPDATE) when bpf_link doesn't support
update operation.

Fixes: f9d041271cf4 ("bpf: Refactor bpf_link update handling")
Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
---
 kernel/bpf/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Daniel Borkmann May 25, 2020, 10:21 p.m. UTC | #1
On 5/25/20 2:29 PM, Jakub Sitnicki wrote:
> System calls encode returned errors as negative values. Fix a typo that
> breaks this convention for bpf(LINK_UPDATE) when bpf_link doesn't support
> update operation.
> 
> Fixes: f9d041271cf4 ("bpf: Refactor bpf_link update handling")
> Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>

Applied, thanks!
diff mbox series

Patch

diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 431241c74614..f9c86e0579da 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -3913,7 +3913,7 @@  static int link_update(union bpf_attr *attr)
 	if (link->ops->update_prog)
 		ret = link->ops->update_prog(link, new_prog, old_prog);
 	else
-		ret = EINVAL;
+		ret = -EINVAL;
 
 out_put_progs:
 	if (old_prog)