diff options
author | Kyle Moffett <mrmacman_g4@mac.com> | 2005-07-27 23:22:30 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2005-07-27 23:22:30 +0200 |
commit | a77be819f94fc55627ee257f496198ad703aaad4 (patch) | |
tree | 1b6d1a29f39ce0541e1248639adc496986261a13 /net | |
parent | [NET]: Improve presentation of networking driver families. (diff) | |
download | linux-a77be819f94fc55627ee257f496198ad703aaad4.tar.xz linux-a77be819f94fc55627ee257f496198ad703aaad4.zip |
[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 <mrmacman_g4@mac.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/sock.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/net/core/sock.c b/net/core/sock.c index 8b35ccdc2b3b..12f6d9a2a522 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<sizeof(int)) return(-EINVAL); |