socket.c bug fix

Alan Cox (alan@lxorguk.ukuu.org.uk)
Thu, 6 Feb 1997 22:19:28 +0000 (GMT)


> It looks like this was introduced in Alan's "linux/net/socket.c"
> patches.
>
> Alan, I've only had time to glance at the changes, and so far I've
> discovered this: (1) there's a missing "unlock_kernel" at the end of
> "sys_shutdown"; (2) "sys_socketpair" doesn't seem to ever "sockfd_put"
> the descriptors it "sockfd_lookup"s.

Yep thats causing it. Unfortunately I've just committed the stuff for
2.1.26. I doubt this will get fixed in time for .26.

Alan

Try
--- net/socket.c~ Sun Feb 2 17:46:20 1997
+++ net/socket.c Thu Feb 6 22:22:44 1997
@@ -645,7 +645,7 @@
asmlinkage int sys_socketpair(int family, int type, int protocol, int usockvec[2])
{
int fd1, fd2, i;
- struct socket *sock1, *sock2;
+ struct socket *sock1=NULL, *sock2=NULL;
int err;

lock_kernel();
@@ -700,6 +700,10 @@
}
}
out:
+ if(sock1)
+ sockfd_put(sock1);
+ if(sock2)
+ sockfd_put(sock2);
unlock_kernel();
return err;
}
@@ -1114,6 +1118,7 @@
err=sock->ops->shutdown(sock, how);
sockfd_put(sock);
}
+ unlock_kernel();
return err;
}