Skip to content

Commit f2176a0

Browse files
Haoxiang LiVudentz
authored andcommitted
Bluetooth: Add check for mgmt_alloc_skb() in mgmt_remote_name()
Add check for the return value of mgmt_alloc_skb() in mgmt_remote_name() to prevent null pointer dereference. Fixes: ba17bb6 ("Bluetooth: Fix skb allocation in mgmt_remote_name() & mgmt_device_connected()") Cc: [email protected] Signed-off-by: Haoxiang Li <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent cbf85b9 commit f2176a0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/bluetooth/mgmt.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10413,6 +10413,8 @@ void mgmt_remote_name(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 link_type,
1041310413

1041410414
skb = mgmt_alloc_skb(hdev, MGMT_EV_DEVICE_FOUND,
1041510415
sizeof(*ev) + (name ? eir_precalc_len(name_len) : 0));
10416+
if (!skb)
10417+
return;
1041610418

1041710419
ev = skb_put(skb, sizeof(*ev));
1041810420
bacpy(&ev->addr.bdaddr, bdaddr);

0 commit comments

Comments
 (0)