[PATCH] freeing free spin_lock (2.3.33smp)

Mathijs Mohlmann (mathijs@knoware.nl)
Mon, 20 Dec 1999 18:43:05 +0100 (CET)


When I display xawtv-3.02 over my LAN to my 2.3.33 smp laptop,
it killes my X-server, with the following message:

kernel BUG at /usr/src/linux-2.3.33/include/asm/spinlock.h:92!
invalid operand: 0000
CPU: 0
EIP: 0010:[sys_shmat+1370/1696]
EFLAGS: 00013282
eax: 0000003f ebx: 00000006 ecx: 00000012 edx: 00000038
esi: c0322cd4 edi: 000001b6 ebp: 00000000 esp: c7a87f58
ds: 0018 es: 0018 ss: 0018
Process X (pid: 618, stackpage=c7a87000)
Stack: 0000005c bffffadc 00000000 04148006 00000000 ffffffea 04150005
00000ee4
c7a86000 00000000 c7a87f70 ffffffea c0112456 04148006 00000000 00000000
c7a87fb4 c7a86000 bffffadc 00000000 bffffae0 bffffb48 bffffb10 bffffae4
Call Trace: [sys_ipc+346/468] [system_call+52/56] [stext+43/164]
Code: 0f 0b 83 c4 0c 90 f0 0f ba 35 d4 2c 32 c0 00 8b 4c 24 1c 8b

This lead me to the following code. From: linux/ipc/shm.c line
551:

shp = shm_lock(shmid);
if(shp == NULL)
goto out_unlock_up;

. . .
out_unlock_up:
shm_unlock(shmid);
out_up:
up(&current->mm->mmap_sem);
return err;

So, the lock fails and gets unlocked. This didn't somehow seem right to
me. After fixing it, xawtv displays fine (now i can watch TV from my bed
;-))

Here's the patch (against 2.3.33):

diff -ruN linux-2.3.33.orig/ipc/shm.c linux-2.3.33/ipc/shm.c
--- linux-2.3.33.orig/ipc/shm.c Sun Dec 19 23:00:24 1999
+++ linux-2.3.33/ipc/shm.c Mon Dec 20 15:56:48 1999
@@ -550,7 +550,7 @@
err = -EINVAL;
shp = shm_lock(shmid);
if(shp == NULL)
- goto out_unlock_up;
+ goto out_up;

err = -EACCES;
if (ipcperms(&shp->u.shm_perm, flg))

Please also reply to me direct, since i'm not on this list. I will check
the archive.

me

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/