]> err.no Git - linux-2.6/commitdiff
[NET]: Fix setsockopt locking bug
authorKyle Moffett <mrmacman_g4@mac.com>
Wed, 27 Jul 2005 21:22:30 +0000 (14:22 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 27 Jul 2005 21:22:30 +0000 (14:22 -0700)
On Sparc, SO_DONTLINGER support resulted in sock_reset_flag being
called without lock_sock().

Signed-off-by: Kyle Moffett <mrmacman_g4@mac.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/sock.c

index 8b35ccdc2b3b7889f4cf8715389ce25ef43c90f9..12f6d9a2a522c730ef1fbc268bcd50b6b28f6b9b 100644 (file)
@@ -206,13 +206,14 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
         */
 
 #ifdef SO_DONTLINGER           /* Compatibility item... */
-       switch (optname) {
-               case SO_DONTLINGER:
-                       sock_reset_flag(sk, SOCK_LINGER);
-                       return 0;
+       if (optname == SO_DONTLINGER) {
+               lock_sock(sk);
+               sock_reset_flag(sk, SOCK_LINGER);
+               release_sock(sk);
+               return 0;
        }
-#endif 
-               
+#endif
+       
        if(optlen<sizeof(int))
                return(-EINVAL);