bpf: fix a return in sockmap_get_from_fd()
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 18 Aug 2017 07:27:02 +0000 (10:27 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Aug 2017 17:18:20 +0000 (10:18 -0700)
"map" is a valid pointer.  We wanted to return "err" instead.  Also
let's return a zero literal at the end.

Fixes: 174a79ff9515 ("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>
kernel/bpf/syscall.c

index d2f2bdf71ffa362f287c093f632b560a6916fb51..b8cb1b3c9bfb37966c4451a39e0aa4b21c6a3b17 100644 (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)