summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@sunset.davemloft.net>2005-05-04 01:15:59 +0200
committerDavid S. Miller <davem@davemloft.net>2005-05-04 01:15:59 +0200
commit0f4821e7b93fe72e89b8ff393bd8e705bd178aa5 (patch)
treee9116a4ce6593b186c3962fcdc5baf73f243d0b5
parent[NETLINK]: Fix infinite loops in synchronous netlink changes. (diff)
downloadlinux-0f4821e7b93fe72e89b8ff393bd8e705bd178aa5.tar.xz
linux-0f4821e7b93fe72e89b8ff393bd8e705bd178aa5.zip
[XFRM/RTNETLINK]: Decrement qlen properly in {xfrm_,rt}netlink_rcv().
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>
-rw-r--r--net/core/rtnetlink.c4
-rw-r--r--net/xfrm/xfrm_user.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 75b6d33b5292..00caf4b318b2 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -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);
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index e8740a4a1d78..5ddda2c98af9 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -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);