Subject: [PATCH 1/5] sock_create bad error return

From: Stephen Hemminger <[email-masked]>
Date: Wed, 09 Aug 2006 11:31:39 -0700

If socket create call races with module unload, it correctly
fails the socket call but doesn't return an error. This race
is theoritical because the sock->ops are always the same and
non-modular.

Signed-off-by: Stephen Hemminger <[email-masked]>

--- tcp-2.6.orig/net/socket.c
+++ tcp-2.6/net/socket.c
@@ -1204,6 +1204,7 @@ static int __sock_create(int family, int
 	 * socket at sock_release time we decrement its refcnt.
 	 */
 	if (!try_module_get(sock->ops->owner)) {
+		err = -EAGAIN;
 		sock->ops = NULL;
 		goto out_module_put;
 	}

--