summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorHaoxiang Li <haoxiang_li2024@163.com>2025-02-21 16:58:01 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-13 13:07:47 +0100
commit7d39387886ffe220323cbed5c155233c3276926b (patch)
tree8d3a6f244fe32be7238e5b443f1fffc67b81e23d /net
parent69fb168b88e4d62cb31cdd725b67ccc5216cfcaf (diff)
downloadlinux-7d39387886ffe220323cbed5c155233c3276926b.tar.gz
linux-7d39387886ffe220323cbed5c155233c3276926b.tar.bz2
linux-7d39387886ffe220323cbed5c155233c3276926b.zip
Bluetooth: Add check for mgmt_alloc_skb() in mgmt_device_connected()
commit d8df010f72b8a32aaea393e36121738bb53ed905 upstream. Add check for the return value of mgmt_alloc_skb() in mgmt_device_connected() to prevent null pointer dereference. Fixes: e96741437ef0 ("Bluetooth: mgmt: Make use of mgmt_send_event_skb in MGMT_EV_DEVICE_CONNECTED") Cc: stable@vger.kernel.org Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/mgmt.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 1a7f6a2fda84..aa8b0df41291 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -9791,6 +9791,9 @@ void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,
sizeof(*ev) + (name ? eir_precalc_len(name_len) : 0) +
eir_precalc_len(sizeof(conn->dev_class)));
+ if (!skb)
+ return;
+
ev = skb_put(skb, sizeof(*ev));
bacpy(&ev->addr.bdaddr, &conn->dst);
ev->addr.type = link_to_bdaddr(conn->type, conn->dst_type);