aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/6lowpan.c
diff options
context:
space:
mode:
authorJukka Rissanen <jukka.rissanen@linux.intel.com>2014-10-01 15:59:14 +0300
committerJohan Hedberg <johan.hedberg@intel.com>2014-10-02 13:41:39 +0300
commitd7b6b0a532da7de25e16deed610658cfa1969fe9 (patch)
tree27847fc8c5f0d29c39821b176f60c0f2593bdf96 /net/bluetooth/6lowpan.c
parentBluetooth: 6lowpan: Avoid memory leak if memory allocation fails (diff)
downloadlinux-dev-d7b6b0a532da7de25e16deed610658cfa1969fe9.tar.xz
linux-dev-d7b6b0a532da7de25e16deed610658cfa1969fe9.zip
Bluetooth: 6lowpan: Return EAGAIN error also for multicast packets
Make sure that we are able to return EAGAIN from l2cap_chan_send() even for multicast packets. The error code was ignored unncessarily. Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/6lowpan.c')
-rw-r--r--net/bluetooth/6lowpan.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 44eaad77e70c..fcfaa7006b28 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -509,21 +509,16 @@ static int header_create(struct sk_buff *skb, struct net_device *netdev,
/* Packet to BT LE device */
static int send_pkt(struct l2cap_chan *chan, struct sk_buff *skb,
- struct net_device *netdev, bool is_mcast)
+ struct net_device *netdev)
{
struct msghdr msg;
struct kvec iv;
int err;
/* Remember the skb so that we can send EAGAIN to the caller if
- * we run out of credits. This is not done for multicast packets
- * because we generate mcast packet in this module and are not
- * really able to remember the skb after this packet is sent.
+ * we run out of credits.
*/
- if (is_mcast)
- chan->data = NULL;
- else
- chan->data = skb;
+ chan->data = skb;
memset(&msg, 0, sizeof(msg));
msg.msg_iov = (struct iovec *) &iv;
@@ -575,7 +570,7 @@ static void send_mcast_pkt(struct sk_buff *skb, struct net_device *netdev)
netdev->name,
&pentry->chan->dst, pentry->chan->dst_type,
&pentry->peer_addr, pentry->chan);
- send_pkt(pentry->chan, local_skb, netdev, true);
+ send_pkt(pentry->chan, local_skb, netdev);
kfree_skb(local_skb);
}
@@ -617,8 +612,7 @@ static netdev_tx_t bt_xmit(struct sk_buff *skb, struct net_device *netdev)
BT_DBG("xmit %s to %pMR type %d IP %pI6c chan %p",
netdev->name, &addr, addr_type,
&lowpan_cb(skb)->addr, lowpan_cb(skb)->chan);
- err = send_pkt(lowpan_cb(skb)->chan, skb, netdev,
- false);
+ err = send_pkt(lowpan_cb(skb)->chan, skb, netdev);
} else {
err = -ENOENT;
}