]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[NET]: sanitize kernel_accept() error path
authorTony Battersby <tonyb@cybernetics.com>
Thu, 11 Oct 2007 04:09:04 +0000 (21:09 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Oct 2007 04:09:04 +0000 (21:09 -0700)
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>
net/socket.c

index d2336472f4943bea9fb5547b6dc7b2d67a396334..379b3a3907551f50d42776664d0bc66aafcfa671 100644 (file)
@@ -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;
        }