aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorTony Battersby <tonyb@cybernetics.com>2007-10-23 03:10:10 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2007-11-16 08:27:37 -0800
commitcfebbe5fa7f4a2ec9f3b9edd56b877dc5c06f6a0 (patch)
tree21d51038e3a8c85a4a5105e661ca743361b749d6 /net
parent9fcba4716e6ebbb0d7e0ec84bff6dd2c36c847b3 (diff)
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 <tonyb@cybernetics.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'net')
-rw-r--r--net/socket.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c
index b09eb9036a1..a0575243ef7 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;
}