diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2017-04-26 12:15:21 +0300 |
---|---|---|
committer | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2017-04-28 15:01:10 +0300 |
commit | 86a72e1ed4cf29d882745d2be0bdf0a8b9cc5d6d (patch) | |
tree | af1bc7421c416bf969eedd1770f880488e803e48 /subsys | |
parent | efc3ba6b9885f78305d93f991f697143cbf96ab6 (diff) |
net: bt: Fix leaking TX packets
Bluetooth only cares about the actual payload so net_pkt can be unref
as soon as the data fragments are detached.
Jira: ZEP-2070
Change-Id: Id528d5440f42903378883f5e696b3f663bbfa313
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'subsys')
-rw-r--r-- | subsys/net/ip/l2/bluetooth.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/subsys/net/ip/l2/bluetooth.c b/subsys/net/ip/l2/bluetooth.c index 8e2714d84..103555b18 100644 --- a/subsys/net/ip/l2/bluetooth.c +++ b/subsys/net/ip/l2/bluetooth.c @@ -225,11 +225,18 @@ static struct bt_context bt_context_data = { static int bt_iface_send(struct net_if *iface, struct net_pkt *pkt) { struct bt_context *ctxt = net_if_get_device(iface)->driver_data; + struct net_buf *frags; int ret; NET_DBG("iface %p pkt %p len %zu", iface, pkt, net_pkt_get_len(pkt)); - ret = bt_l2cap_chan_send(&ctxt->ipsp_chan.chan, pkt->frags); + /* Dettach data fragments for packet */ + frags = pkt->frags; + pkt->frags = NULL; + + net_pkt_unref(pkt); + + ret = bt_l2cap_chan_send(&ctxt->ipsp_chan.chan, frags); if (ret < 0) { return ret; } |