]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Bluetooth: 6lowpan: fix skb_unshare behaviour
authorAlexander Aring <alex.aring@gmail.com>
Wed, 8 Oct 2014 08:24:53 +0000 (10:24 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Sat, 8 Nov 2014 19:29:35 +0000 (20:29 +0100)
This patch reverts commit:

a7807d73 ("Bluetooth: 6lowpan: Avoid memory leak if memory allocation
fails")

which was wrong suggested by Alexander Aring. The function skb_unshare
run also kfree_skb on failure.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org # 3.18.x
net/bluetooth/6lowpan.c

index dc23c55f1ab66331a478a2bcc6b0a52c803929ae..3f20dce9d671204497d9a7fc885f1e7c237ac31a 100644 (file)
@@ -614,17 +614,13 @@ static netdev_tx_t bt_xmit(struct sk_buff *skb, struct net_device *netdev)
        int err = 0;
        bdaddr_t addr;
        u8 addr_type;
-       struct sk_buff *tmpskb;
 
        /* We must take a copy of the skb before we modify/replace the ipv6
         * header as the header could be used elsewhere
         */
-       tmpskb = skb_unshare(skb, GFP_ATOMIC);
-       if (!tmpskb) {
-               kfree_skb(skb);
+       skb = skb_unshare(skb, GFP_ATOMIC);
+       if (!skb)
                return NET_XMIT_DROP;
-       }
-       skb = tmpskb;
 
        /* Return values from setup_header()
         *  <0 - error, packet is dropped