Skip to content

Commit 0753c18

Browse files
Gustavo Padovanjhedberg
authored andcommitted
Bluetooth: Fix skb allocation check for A2MP
vtable's method alloc_skb() needs to return a ERR_PTR in case of err and not a NULL. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
1 parent b9e2535 commit 0753c18

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎net/bluetooth/a2mp.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,13 @@ static void a2mp_chan_state_change_cb(struct l2cap_chan *chan, int state,
695695
static struct sk_buff *a2mp_chan_alloc_skb_cb(struct l2cap_chan *chan,
696696
unsigned long len, int nb)
697697
{
698-
return bt_skb_alloc(len, GFP_KERNEL);
698+
struct sk_buff *skb;
699+
700+
skb = bt_skb_alloc(len, GFP_KERNEL);
701+
if (!skb)
702+
return ERR_PTR(-ENOMEM);
703+
704+
return skb;
699705
}
700706

701707
static struct l2cap_ops a2mp_chan_ops = {

0 commit comments

Comments
 (0)