Skip to contentSkip to conversation

bpf: Fix returned error sign when link doesn't support updates

PATCH Applied Jakub Sitnicki 2 participants 2 messages May 25, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bpf: Fix returned error sign when link doesn't support updates

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")
---
 kernel/bpf/syscall.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/syscall.c +1 -1
index 431241c74614..f9c86e0579da 100644
@@ -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)
Signature · 1 line
2.25.4
maintainer Applied
#1 lore raw
Quoted 6 lines · Jakub Sitnicki

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")

Applied, thanks!