Skip to content

Commit

Permalink
[NET]: sanitize kernel_accept() error path
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
abattersby authored and davem330 committed Oct 11, 2007
1 parent 414c66e commit fa8705b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit fa8705b

Please sign in to comment.