提交 9a1875e6 编写于 作者: D David S. Miller

[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: NDavid S. Miller <davem@davemloft.net>
上级 2722971c
......@@ -1418,7 +1418,8 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, int _
newfd = sock_alloc_fd(&newfile);
if (unlikely(newfd < 0)) {
err = newfd;
goto out_release;
sock_release(newsock);
goto out_put;
}
err = sock_attach_fd(newsock, newfile);
......@@ -1457,8 +1458,6 @@ asmlinkage long sys_accept(int fd, struct sockaddr __user *upeer_sockaddr, int _
out_fd:
fput(newfile);
put_unused_fd(newfd);
out_release:
sock_release(newsock);
goto out_put;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册