From fa8705b00aeca19d91a1437b8a5cf865999b28f6 Mon Sep 17 00:00:00 2001 From: Tony Battersby Date: Wed, 10 Oct 2007 21:09:04 -0700 Subject: [PATCH] [NET]: sanitize kernel_accept() error path If kernel_accept() returns an error, it may pass back a pointer to freed memory (which the caller should ignore). Make it pass back NULL instead for better safety. Signed-off-by: Tony Battersby Signed-off-by: David S. Miller --- net/socket.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/socket.c b/net/socket.c index d2336472f494..379b3a390755 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2235,6 +2235,7 @@ int kernel_accept(struct socket *sock, struct socket **newsock, int flags) err = sock->ops->accept(sock, *newsock, flags); if (err < 0) { sock_release(*newsock); + *newsock = NULL; goto done; }