From: Gustavo Padovan Date: Sat, 22 Dec 2012 03:22:53 +0000 (-0200) Subject: Bluetooth: Fix skb allocation check for A2MP X-Git-Tag: v3.15-rc1~113^2~93^2^2~4^2~16 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=0753c182ef11e27f8f3dea2dc9ca4bcf40019eb5;p=karo-tx-linux.git 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 Signed-off-by: Johan Hedberg --- diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index f986b9968bdb..d6bb096ba0f1 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c @@ -695,7 +695,13 @@ static void a2mp_chan_state_change_cb(struct l2cap_chan *chan, int state, static struct sk_buff *a2mp_chan_alloc_skb_cb(struct l2cap_chan *chan, unsigned long len, int nb) { - return bt_skb_alloc(len, GFP_KERNEL); + struct sk_buff *skb; + + skb = bt_skb_alloc(len, GFP_KERNEL); + if (!skb) + return ERR_PTR(-ENOMEM); + + return skb; } static struct l2cap_ops a2mp_chan_ops = {