[X25]: fix for spinlock recurse and spinlock lockup with timer handler
authorShaun Pereira <spereira@tusc.com.au>
Fri, 28 Apr 2006 19:00:17 +0000 (12:00 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 30 Apr 2006 01:33:11 +0000 (18:33 -0700)
When the sk_timer function x25_heartbeat_expiry() is called by the
kernel in a running/terminating process, spinlock-recursion and
spinlock-lockup locks up the kernel.  This has happened with testing
on some distro's and the patch below fixed it.

Signed-off-by: Shaun Pereira <spereira@tusc.com.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/x25/x25_timer.c

index 0a92e1da3922dc802b51cc93dd0d9f8a0a9d2f22..71ff3088f6fe325cb7321df423566ce59e420b5e 100644 (file)
@@ -114,8 +114,9 @@ static void x25_heartbeat_expiry(unsigned long param)
                        if (sock_flag(sk, SOCK_DESTROY) ||
                            (sk->sk_state == TCP_LISTEN &&
                             sock_flag(sk, SOCK_DEAD))) {
+                               bh_unlock_sock(sk);
                                x25_destroy_socket(sk);
-                               goto unlock;
+                               return;
                        }
                        break;
 
@@ -128,7 +129,6 @@ static void x25_heartbeat_expiry(unsigned long param)
        }
 restart_heartbeat:
        x25_start_heartbeat(sk);
-unlock:
        bh_unlock_sock(sk);
 }