mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-22 14:41:27 +00:00
[NET]: Fully fix the memory leaks in sys_accept().
Andi Kleen was right, fput() on sock->file will end up calling sock_release() if necessary. So here is the rest of his version of the fix for these leaks. Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2722971cbe
commit
9a1875e60e
1 changed files with 2 additions and 3 deletions
|
@ -1418,7 +1418,8 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, int _
|
||||||
newfd = sock_alloc_fd(&newfile);
|
newfd = sock_alloc_fd(&newfile);
|
||||||
if (unlikely(newfd < 0)) {
|
if (unlikely(newfd < 0)) {
|
||||||
err = newfd;
|
err = newfd;
|
||||||
goto out_release;
|
sock_release(newsock);
|
||||||
|
goto out_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = sock_attach_fd(newsock, newfile);
|
err = sock_attach_fd(newsock, newfile);
|
||||||
|
@ -1457,8 +1458,6 @@ out:
|
||||||
out_fd:
|
out_fd:
|
||||||
fput(newfile);
|
fput(newfile);
|
||||||
put_unused_fd(newfd);
|
put_unused_fd(newfd);
|
||||||
out_release:
|
|
||||||
sock_release(newsock);
|
|
||||||
goto out_put;
|
goto out_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue