[NETLINK]: Fix infinite loops in synchronous netlink changes.
[sfrench/cifs-2.6.git] / net / core / rtnetlink.c
index 6e1ab1e34b2ec70630009aa4b4fd2f4ebac8a35c..75b6d33b52924787089a3dcc9971ddecb8185113 100644 (file)
@@ -626,14 +626,13 @@ static void rtnetlink_rcv(struct sock *sk, int len)
                if (qlen > skb_queue_len(&sk->sk_receive_queue))
                        qlen = skb_queue_len(&sk->sk_receive_queue);
 
-               while (qlen--) {
+               for (; qlen; qlen--) {
                        skb = skb_dequeue(&sk->sk_receive_queue);
                        if (rtnetlink_rcv_skb(skb)) {
-                               if (skb->len) {
+                               if (skb->len)
                                        skb_queue_head(&sk->sk_receive_queue,
                                                       skb);
-                                       qlen++;
-                               } else
+                               else
                                        kfree_skb(skb);
                                break;
                        }