]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Fix kernel_accept() return handling.
authorTony Battersby <tonyb@cybernetics.com>
Tue, 23 Oct 2007 10:10:10 +0000 (03:10 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 16 Nov 2007 16:27:37 +0000 (08:27 -0800)
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>
net/socket.c

index b09eb9036a17a3563e9ad5ca08a1734b86aa0df5..a0575243ef7abbaa76ba237c71e924fe10f7ea18 100644 (file)
@@ -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;
        }