aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/6lowpan.c
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-10-08 04:24:53 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-11-08 14:29:35 -0500
commitb0c42cd7b210efc74aa4bfc3e39a2814dfaa9b89 (patch)
treed87c983453f86c5a95472417e68faf269aec6a0e /net/bluetooth/6lowpan.c
parentcb77c3ec075a50e9f956f62dc2e4c0394df1d578 (diff)
Bluetooth: 6lowpan: fix skb_unshare behaviour
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
Diffstat (limited to 'net/bluetooth/6lowpan.c')
-rw-r--r--net/bluetooth/6lowpan.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index dc23c55f1ab6..3f20dce9d671 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -614,17 +614,13 @@ static netdev_tx_t bt_xmit(struct sk_buff *skb, struct net_device *netdev)
614 int err = 0; 614 int err = 0;
615 bdaddr_t addr; 615 bdaddr_t addr;
616 u8 addr_type; 616 u8 addr_type;
617 struct sk_buff *tmpskb;
618 617
619 /* We must take a copy of the skb before we modify/replace the ipv6 618 /* We must take a copy of the skb before we modify/replace the ipv6
620 * header as the header could be used elsewhere 619 * header as the header could be used elsewhere
621 */ 620 */
622 tmpskb = skb_unshare(skb, GFP_ATOMIC); 621 skb = skb_unshare(skb, GFP_ATOMIC);
623 if (!tmpskb) { 622 if (!skb)
624 kfree_skb(skb);
625 return NET_XMIT_DROP; 623 return NET_XMIT_DROP;
626 }
627 skb = tmpskb;
628 624
629 /* Return values from setup_header() 625 /* Return values from setup_header()
630 * <0 - error, packet is dropped 626 * <0 - error, packet is dropped