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: 174a79ff95 ("bpf: sockmap with sk redirect support")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Dan Carpenter 2017-08-18 10:27:02 +03:00 committed by David S. Miller
parent 98ee2a1137
commit ae2b27b859

View File

@ -1125,11 +1125,11 @@ static int sockmap_get_from_fd(const union bpf_attr *attr, int ptype)
fdput(f);
bpf_prog_put(prog1);
bpf_prog_put(prog2);
return PTR_ERR(map);
return err;
}
fdput(f);
return err;
return 0;
}
static int bpf_prog_attach(const union bpf_attr *attr)