diff options
author | Tony Battersby <tonyb@cybernetics.com> | 2007-10-11 00:09:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2007-10-11 00:09:04 -0400 |
commit | fa8705b00aeca19d91a1437b8a5cf865999b28f6 (patch) | |
tree | d91cf4fe1b632836d286a1216b4f821903b8d4f5 /net/socket.c | |
parent | 414c66e00e9fb4572e38bd14e6cc570eae8c5a61 (diff) |
[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>
Diffstat (limited to 'net/socket.c')
-rw-r--r-- | net/socket.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/net/socket.c b/net/socket.c index d2336472f494..379b3a390755 100644 --- a/net/socket.c +++ b/net/socket.c | |||
@@ -2235,6 +2235,7 @@ int kernel_accept(struct socket *sock, struct socket **newsock, int flags) | |||
2235 | err = sock->ops->accept(sock, *newsock, flags); | 2235 | err = sock->ops->accept(sock, *newsock, flags); |
2236 | if (err < 0) { | 2236 | if (err < 0) { |
2237 | sock_release(*newsock); | 2237 | sock_release(*newsock); |
2238 | *newsock = NULL; | ||
2238 | goto done; | 2239 | goto done; |
2239 | } | 2240 | } |
2240 | 2241 | ||