From: Kyle Moffett Date: Wed, 27 Jul 2005 21:22:30 +0000 (-0700) Subject: [NET]: Fix setsockopt locking bug X-Git-Tag: v2.6.13-rc4~25^2~5^2~2 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a77be819f94fc55627ee257f496198ad703aaad4;p=linux-2.6 [NET]: Fix setsockopt locking bug On Sparc, SO_DONTLINGER support resulted in sock_reset_flag being called without lock_sock(). Signed-off-by: Kyle Moffett Signed-off-by: David S. Miller --- diff --git a/net/core/sock.c b/net/core/sock.c index 8b35ccdc2b..12f6d9a2a5 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -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