Commit ae2b27b8 authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

bpf: fix a return in sockmap_get_from_fd()

"map" is a valid pointer.  We wanted to return "err" instead.  Also
let's return a zero literal at the end.

Fixes: 174a79ff ("bpf: sockmap with sk redirect support")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarJohn Fastabend <john.fastabend@gmail.com>
Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 98ee2a11
...@@ -1125,11 +1125,11 @@ static int sockmap_get_from_fd(const union bpf_attr *attr, int ptype) ...@@ -1125,11 +1125,11 @@ static int sockmap_get_from_fd(const union bpf_attr *attr, int ptype)
fdput(f); fdput(f);
bpf_prog_put(prog1); bpf_prog_put(prog1);
bpf_prog_put(prog2); bpf_prog_put(prog2);
return PTR_ERR(map); return err;
} }
fdput(f); fdput(f);
return err; return 0;
} }
static int bpf_prog_attach(const union bpf_attr *attr) static int bpf_prog_attach(const union bpf_attr *attr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment