diff options
author | Alexander Aring <alex.aring@gmail.com> | 2014-10-08 10:24:53 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-01-16 06:59:47 -0800 |
commit | bff7d3f06a2ff8036e310e2e7a4192c4bed4a9da (patch) | |
tree | 1b6263a368ea836b44e318fc22ab41c3f94de1a8 | |
parent | 767d883679c895f0e1f3f439db0a593678602a6e (diff) | |
download | linux-rt-bff7d3f06a2ff8036e310e2e7a4192c4bed4a9da.tar.gz |
Bluetooth: 6lowpan: fix skb_unshare behaviour
commit b0c42cd7b210efc74aa4bfc3e39a2814dfaa9b89 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/bluetooth/6lowpan.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c index c2e0d14433df..cfbb39e6fdfd 100644 --- a/net/bluetooth/6lowpan.c +++ b/net/bluetooth/6lowpan.c @@ -591,17 +591,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 |