[IPV6] RAW: Don't release unlocked sock.
authorMasahide NAKAMURA <nakam@linux-ipv6.org>
Tue, 5 Dec 2006 21:48:27 +0000 (13:48 -0800)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 7 Dec 2006 02:39:09 +0000 (18:39 -0800)
When user builds IPv6 header and send it through raw socket, kernel
tries to release unlocked sock. (Kernel log shows
"BUG: bad unlock balance detected" with enabled debug option.)

The lock is held only for non-hdrincl sock in this function
then this patch fix to do nothing about lock for hdrincl one.

Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/raw.c

index c2e629d6aea40e5519c3b865d62e1a092e6c9b60..4ae1b19ada5d3eb9e3c3c7f0b1b7a8030002eacb 100644 (file)
@@ -854,7 +854,8 @@ back_from_confirm:
        }
 done:
        dst_release(dst);
-       release_sock(sk);
+       if (!inet->hdrincl)
+               release_sock(sk);
 out:   
        fl6_sock_release(flowlabel);
        return err<0?err:len;