Subject: Re: [AX25] kernel panic

From: Jarek Poplawski <[email-masked]>
Date: Sat, 22 Mar 2008 12:36:20 +0100

On Thu, Mar 20, 2008 at 11:58:35PM +0100, Bernard Pidoux wrote:
...
> BUG: spinlock bad magic on CPU#0, swapper/0
> BUG: unable to handle kernel paging request at virtual address 6b6b6c2f
> printing eip: c01e730b *pde = 00000000
> Oops: 0000 [#1] SMP
...
> Pid: 0, comm: swapper Not tainted (2.6.24.3 #8)
> EIP: 0060:[<c01e730b>] EFLAGS: 00010002 CPU: 0
> EIP is at spin_bug+0xdb/0xf0
...

Hi,

Bernard, could you try this debugging patch?

Thanks,
Jarek P.

---

diff -Nurp 2.6.24.3-/net/core/sock.c 2.6.24.3+/net/core/sock.c
--- 2.6.24.3-/net/core/sock.c	2008-01-24 23:58:37.000000000 +0100
+++ 2.6.24.3+/net/core/sock.c	2008-03-22 12:10:10.000000000 +0100
@@ -1517,14 +1517,21 @@ static void sock_def_write_space(struct 
 	 * progress.  --DaveM
 	 */
 	if ((atomic_read(&sk->sk_wmem_alloc) << 1) <= sk->sk_sndbuf) {
-		if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
+		if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) {
+			if (!sk->sk_socket || sk->sk_socket->sk != sk) {
+				WARN_ON_ONCE(1);
+				sk->sk_socket = NULL;
+				sk->sk_sleep = NULL;
+				goto out;
+			}
 			wake_up_interruptible(sk->sk_sleep);
+		}
 
 		/* Should agree with poll, otherwise some programs break */
 		if (sock_writeable(sk))
 			sk_wake_async(sk, 2, POLL_OUT);
 	}
-
+out:
 	read_unlock(&sk->sk_callback_lock);
 }