]> git.baikalelectronics.ru Git - kernel.git/commitdiff
bpf: Fix returned error sign when link doesn't support updates
authorJakub Sitnicki <jakub@cloudflare.com>
Mon, 25 May 2020 12:29:28 +0000 (14:29 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 1 Jun 2020 21:38:19 +0000 (14:38 -0700)
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: 1b533cb73396 ("bpf: Refactor bpf_link update handling")
Signed-off-by: Jakub Sitnicki <jakub@cloudflare.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200525122928.1164495-1-jakub@cloudflare.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/syscall.c

index aaa29fb6f363a8d5e3a3420e8f7d7516fcc59fc1..d13b804ff0453fdd4ad0b83957a47052c9e4b839 100644 (file)
@@ -3924,7 +3924,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)