All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] bpf: fix a return in sockmap_get_from_fd()
@ 2017-08-18  7:27 ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2017-08-18  7:27 UTC (permalink / raw)
  To: Alexei Starovoitov, John Fastabend
  Cc: Daniel Borkmann, netdev, kernel-janitors

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

diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index d2f2bdf71ffa..b8cb1b3c9bfb 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -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)

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-08-18 17:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-18  7:27 [PATCH net-next] bpf: fix a return in sockmap_get_from_fd() Dan Carpenter
2017-08-18  7:27 ` Dan Carpenter
2017-08-18  7:40 ` John Fastabend
2017-08-18  7:40   ` John Fastabend
2017-08-18  8:21 ` Daniel Borkmann
2017-08-18  8:21   ` Daniel Borkmann
2017-08-18 17:18 ` David Miller
2017-08-18 17:18   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.