aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorJesper Juhl <jesper.juhl@gmail.com>2006-06-26 03:24:33 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-26 12:58:16 -0400
commit57136ca6d57359c7f21a9bbb4a5a0a61eeb53f2b (patch)
tree79c31abe40196cc1c350734a15d146d43fa3692c /drivers/bluetooth
parent81615b624a45621b758380ec45d750483eae281d (diff)
[PATCH] Bluetooth: fix potential NULL ptr deref in dtl1_cs.c::dtl1_hci_send_frame()
There's a problem in drivers/bluetooth/dtl1_cs.c::dtl1_hci_send_frame() If bt_skb_alloc() returns NULL, then skb_reserve(s, NSHL); will cause a NULL pointer deref - ouch. If we can't allocate the resources we require we need to tell the caller by returning -ENOMEM. Found by the coverity checker as bug #409 Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/dtl1_cs.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c
index a71a240611e0..ed8dca84ff69 100644
--- a/drivers/bluetooth/dtl1_cs.c
+++ b/drivers/bluetooth/dtl1_cs.c
@@ -423,6 +423,9 @@ static int dtl1_hci_send_frame(struct sk_buff *skb)
423 nsh.len = skb->len; 423 nsh.len = skb->len;
424 424
425 s = bt_skb_alloc(NSHL + skb->len + 1, GFP_ATOMIC); 425 s = bt_skb_alloc(NSHL + skb->len + 1, GFP_ATOMIC);
426 if (!s)
427 return -ENOMEM;
428
426 skb_reserve(s, NSHL); 429 skb_reserve(s, NSHL);
427 memcpy(skb_put(s, skb->len), skb->data, skb->len); 430 memcpy(skb_put(s, skb->len), skb->data, skb->len);
428 if (skb->len & 0x0001) 431 if (skb->len & 0x0001)