netdev
[Top] [All Lists]

Re: assertion (!atomic_read(&sk->sk_rmem_alloc)) failed at net/netlink/a

To: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Subject: Re: assertion (!atomic_read(&sk->sk_rmem_alloc)) failed at net/netlink/af_netlink.c (122)
From: Tommy Christensen <tommy.christensen@xxxxxxxxx>
Date: Thu, 12 May 2005 11:58:07 +0200
Cc: Ken-ichirou MATSUZAWA <chamas@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxx, "David S. Miller" <davem@xxxxxxxxxxxxx>
In-reply-to: <20050511231751.GA21781@xxxxxxxxxxxxxxxxxxx>
References: <20050510.214332.-1300551106.chamas@xxxxxxxxxxxxx> <20050510220751.GA459@xxxxxxxxxxxxxxxxxxx> <20050511005836.GA1674@xxxxxxxxxxxxxxxxxxx> <4282846F.6070403@xxxxxxxxx> <20050511231751.GA21781@xxxxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
On Thu, 2005-05-12 at 01:17, Herbert Xu wrote:
> BTW, we could also move the skb_orphan to the skb_get path since the
> cloned packets don't need the orphan call.

Yes, I like this better.  Good idea.

Signed-off-by: Tommy S. Christensen <tommy.christensen@xxxxxxxxx>

diff -ru linux-2.6.12-rc4/net/netlink/af_netlink.c 
linux-2.6.12-work/net/netlink/af_netlink.c
--- linux-2.6.12-rc4/net/netlink/af_netlink.c   2005-05-11 11:10:20.000000000 
+0200
+++ linux-2.6.12-work/net/netlink/af_netlink.c  2005-05-12 11:51:57.427312857 
+0200
@@ -735,11 +735,13 @@
 
        sock_hold(sk);
        if (p->skb2 == NULL) {
-               if (atomic_read(&p->skb->users) != 1) {
+               if (skb_shared(p->skb)) {
                        p->skb2 = skb_clone(p->skb, p->allocation);
                } else {
-                       p->skb2 = p->skb;
-                       atomic_inc(&p->skb->users);
+                       p->skb2 = skb_get(p->skb);
+                       /* skb ownership may have been set when
+                          delivered to a previous socket. */
+                       skb_orphan(p->skb2);
                }
        }
        if (p->skb2 == NULL) {
<Prev in Thread] Current Thread [Next in Thread>