Commit fa8705b0 authored by Tony Battersby's avatar Tony Battersby Committed by David S. Miller

[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: default avatarTony Battersby <tonyb@cybernetics.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 414c66e0
...@@ -2235,6 +2235,7 @@ int kernel_accept(struct socket *sock, struct socket **newsock, int flags) ...@@ -2235,6 +2235,7 @@ int kernel_accept(struct socket *sock, struct socket **newsock, int flags)
err = sock->ops->accept(sock, *newsock, flags); err = sock->ops->accept(sock, *newsock, flags);
if (err < 0) { if (err < 0) {
sock_release(*newsock); sock_release(*newsock);
*newsock = NULL;
goto done; goto done;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment