netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: fix kernel_accept() error path
@ 2007-10-04 20:20 Tony Battersby
  2007-10-04 21:57 ` James Morris
  0 siblings, 1 reply; 5+ messages in thread
From: Tony Battersby @ 2007-10-04 20:20 UTC (permalink / raw)
  To: netdev, davem

If accept() returns an error, kernel_accept() releases the new socket
but passes a pointer to the released socket back to the caller.  Make it
pass back NULL instead.

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
---
--- linux-2.6.23-rc9/net/socket.c.bak	2007-10-04 15:21:17.000000000 -0400
+++ linux-2.6.23-rc9/net/socket.c	2007-10-04 15:21:22.000000000 -0400
@@ -2230,6 +2230,7 @@ int kernel_accept(struct socket *sock, s
 	err = sock->ops->accept(sock, *newsock, flags);
 	if (err < 0) {
 		sock_release(*newsock);
+		*newsock = NULL;
 		goto done;
 	}
 



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-10-04 23:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-04 20:20 [PATCH] net: fix kernel_accept() error path Tony Battersby
2007-10-04 21:57 ` James Morris
2007-10-04 22:08   ` David Miller
2007-10-04 22:12   ` Tony Battersby
2007-10-04 23:55     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).