Skip to content

Commit

Permalink
[XFRM/RTNETLINK]: Decrement qlen properly in {xfrm_,rt}netlink_rcv().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David S. Miller authored and davem330 committed May 3, 2005
1 parent 09e1430 commit 0f4821e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion net/xfrm/xfrm_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 0f4821e

Please sign in to comment.