Commit cfebbe5f authored by Tony Battersby's avatar Tony Battersby Committed by Greg Kroah-Hartman

Fix kernel_accept() return handling.

patch fa8705b0 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: default avatarTony Battersby <tonyb@cybernetics.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9fcba471
...@@ -2230,6 +2230,7 @@ int kernel_accept(struct socket *sock, struct socket **newsock, int flags) ...@@ -2230,6 +2230,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