Skip to content

Commit d8df010

Browse files
Haoxiang LiVudentz
authored andcommitted
Bluetooth: Add check for mgmt_alloc_skb() in mgmt_device_connected()
Add check for the return value of mgmt_alloc_skb() in mgmt_device_connected() to prevent null pointer dereference. Fixes: e967414 ("Bluetooth: mgmt: Make use of mgmt_send_event_skb in MGMT_EV_DEVICE_CONNECTED") Cc: [email protected] Signed-off-by: Haoxiang Li <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent f2176a0 commit d8df010

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/bluetooth/mgmt.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9660,6 +9660,9 @@ void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,
96609660
sizeof(*ev) + (name ? eir_precalc_len(name_len) : 0) +
96619661
eir_precalc_len(sizeof(conn->dev_class)));
96629662

9663+
if (!skb)
9664+
return;
9665+
96639666
ev = skb_put(skb, sizeof(*ev));
96649667
bacpy(&ev->addr.bdaddr, &conn->dst);
96659668
ev->addr.type = link_to_bdaddr(conn->type, conn->dst_type);

0 commit comments

Comments
 (0)