From cfebbe5fa7f4a2ec9f3b9edd56b877dc5c06f6a0 Mon Sep 17 00:00:00 2001 From: Tony Battersby Date: Tue, 23 Oct 2007 03:10:10 -0700 Subject: [PATCH] Fix kernel_accept() return handling. patch fa8705b00aeca19d91a1437b8a5cf865999b28f6 in mainline. [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 Signed-off-by: Greg Kroah-Hartman --- net/socket.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/socket.c b/net/socket.c index b09eb9036a17..a0575243ef7a 100644 --- a/net/socket.c +++ b/net/socket.c @@ -2230,6 +2230,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; } -- 2.39.5