diff options
author | David S. Miller <davem@sunset.davemloft.net> | 2006-04-01 22:48:36 +0200 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-04-01 22:48:36 +0200 |
commit | 9a1875e60e61b563737d8d1fc3876b279710fe93 (patch) | |
tree | 68b54f8b90b046d6cd49f0560c40b1cddb5502a2 /net/socket.c | |
parent | [NETFILTER]: iptables 32bit compat layer (diff) | |
download | linux-9a1875e60e61b563737d8d1fc3876b279710fe93.tar.xz linux-9a1875e60e61b563737d8d1fc3876b279710fe93.zip |
[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>
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/net/socket.c b/net/socket.c index bbc80780f45a..b807f360e02c 100644 --- a/net/socket.c +++ b/net/socket.c @@ -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 @@ out: out_fd: fput(newfile); put_unused_fd(newfd); -out_release: - sock_release(newsock); goto out_put; } |