Skip to content

Commit

Permalink
[NET]: Fix setsockopt locking bug
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kyle Moffett authored and David S. Miller committed Jul 27, 2005
1 parent cbcd2a4 commit a77be81
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit a77be81

Please sign in to comment.