mac802154: rx: add error handling after skb_clone
authorAlexander Aring <alex.aring@gmail.com>
Wed, 29 Oct 2014 20:34:42 +0000 (21:34 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 29 Oct 2014 22:07:46 +0000 (23:07 +0100)
This patch adds error handling after skb_clone and deliver only if
skb_clone was successful.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/mac802154/rx.c

index 971a8553e9b62614dccd353aeb036051c2f8a0d6..95961cccc253a3e6da82195c7e4ad8421088bd29 100644 (file)
@@ -240,12 +240,13 @@ ieee802154_monitors_rx(struct ieee802154_local *local, struct sk_buff *skb)
                        continue;
 
                skb2 = skb_clone(skb, GFP_ATOMIC);
-               skb2->dev = sdata->dev;
+               if (skb2) {
+                       skb2->dev = sdata->dev;
+                       ieee802154_deliver_skb(skb2);
 
-               ieee802154_deliver_skb(skb2);
-
-               sdata->dev->stats.rx_packets++;
-               sdata->dev->stats.rx_bytes += skb->len;
+                       sdata->dev->stats.rx_packets++;
+                       sdata->dev->stats.rx_bytes += skb->len;
+               }
        }
 }