Commit 72d061ee authored by Dan Carpenter's avatar Dan Carpenter Committed by Luiz Augusto von Dentz
Browse files

Bluetooth: Fix error code in chan_alloc_skb_cb()



The chan_alloc_skb_cb() function is supposed to return error pointers on
error.  Returning NULL will lead to a NULL dereference.

Fixes: 6b8d4a6a ("Bluetooth: 6LoWPAN: Use connected oriented channel instead of fixed one")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
parent 2409fa66
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -825,11 +825,16 @@ static struct sk_buff *chan_alloc_skb_cb(struct l2cap_chan *chan,
					 unsigned long hdr_len,
					 unsigned long len, int nb)
{
	struct sk_buff *skb;

	/* Note that we must allocate using GFP_ATOMIC here as
	 * this function is called originally from netdev hard xmit
	 * function in atomic context.
	 */
	return bt_skb_alloc(hdr_len + len, GFP_ATOMIC);
	skb = bt_skb_alloc(hdr_len + len, GFP_ATOMIC);
	if (!skb)
		return ERR_PTR(-ENOMEM);
	return skb;
}

static void chan_suspend_cb(struct l2cap_chan *chan)