mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 12:16:20 +00:00
[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>
This commit is contained in:
parent
414c66e00e
commit
fa8705b00a
1 changed files with 1 additions and 0 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue