Skip to content

Commit

Permalink
[NET]: Fully fix the memory leaks in sys_accept().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David S. Miller committed Apr 1, 2006
1 parent 2722971 commit 9a1875e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 9a1875e

Please sign in to comment.