Re: 2.0.35pre1 __release_sock oops (again) [__release_sock(NULL)]

Andrea Arcangeli (arcangeli@mbox.queen.it)
Mon, 29 Jun 1998 01:47:01 +0200 (CEST)


On Sun, 28 Jun 1998, Chris Evans wrote:

>Jun 27 14:18:03 ferret kernel: esi: 0057e8d0 edi: 00000000 ebp: 00000001 esp: 037f8f2c
^^^^^^^^^^^^^

edi is NULL and it means that the (struct sock *) sk that take as
parameter __release_sock() is NULL too. It' s a bit strange that the first
dereferencing of the NULL pointer don' t generate a trap (really the
kernel is not dereferencing NULL but NULL+something). Then at the location
NULL+something there is garbage and dereferencing garbage you got the
Oops.

This patch should avoid the Oops, but it' s not the fix, the bug is still
somewhere (I really don' t know where ;-).

Patch against 0.34.

===================================================================
RCS file: linux/net/core/sock.c,v
retrieving revision 1.1
diff -u -r1.1 linux/net/core/sock.c
--- linux/net/core/sock.c 1998/06/28 23:19:00 1.1
+++ linux/net/core/sock.c 1998/06/28 23:41:53
@@ -579,6 +579,13 @@
void __release_sock(struct sock *sk)
{
#ifdef CONFIG_INET
+ if (!sk)
+ {
+ printk(KERN_ERR
+ "__release_sock: BUG detected, can' t release a NULL "
+ "sock!\n");
+ return;
+ }
if (!sk->prot || !sk->prot->rcv)
return;

Andrea[s] Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu