[XFRM/RTNETLINK]: Decrement qlen properly in {xfrm_,rt}netlink_rcv().
authorDavid S. Miller <davem@sunset.davemloft.net>
Tue, 3 May 2005 23:15:59 +0000 (16:15 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 3 May 2005 23:15:59 +0000 (16:15 -0700)
If we free up a partially processed packet because it's
skb->len dropped to zero, we need to decrement qlen because
we are dropping out of the top-level loop so it will do
the decrement for us.

Spotted by Herbert Xu.

Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/rtnetlink.c
net/xfrm/xfrm_user.c

index 75b6d33b52924787089a3dcc9971ddecb8185113..00caf4b318b20831c8fad5226c7c3cd358b4995b 100644 (file)
@@ -632,8 +632,10 @@ static void rtnetlink_rcv(struct sock *sk, int len)
                                if (skb->len)
                                        skb_queue_head(&sk->sk_receive_queue,
                                                       skb);
-                               else
+                               else {
                                        kfree_skb(skb);
+                                       qlen--;
+                               }
                                break;
                        }
                        kfree_skb(skb);
index e8740a4a1d7845704cabda0f0f6f4891bf683761..5ddda2c98af9c8258562f926735fe16fa83025c2 100644 (file)
@@ -1024,8 +1024,10 @@ static void xfrm_netlink_rcv(struct sock *sk, int len)
                                if (skb->len)
                                        skb_queue_head(&sk->sk_receive_queue,
                                                       skb);
-                               else
+                               else {
                                        kfree_skb(skb);
+                                       qlen--;
+                               }
                                break;
                        }
                        kfree_skb(skb);