Skip to content

Commit 727c523

Browse files
committed
Bluetooth: btusb: Fix potential NULL dereference on kmalloc failure
JIRA: https://issues.redhat.com/browse/RHEL-107922 commit b505902 Author: Zhongqiu Han <quic_zhonhan@quicinc.com> Date: Sat Jul 5 18:52:46 2025 +0800 Bluetooth: btusb: Fix potential NULL dereference on kmalloc failure Avoid potential NULL pointer dereference by checking the return value of kmalloc and handling allocation failure properly. Fixes: 7d70989 ("Bluetooth: btusb: Add HCI Drv commands for configuring altsetting") Signed-off-by: Zhongqiu Han <quic_zhonhan@quicinc.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Signed-off-by: David Marlin <dmarlin@redhat.com>
1 parent 66c8549 commit 727c523

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/bluetooth/btusb.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3802,6 +3802,8 @@ static int btusb_hci_drv_supported_altsettings(struct hci_dev *hdev, void *data,
38023802

38033803
/* There are at most 7 alt (0 - 6) */
38043804
rp = kmalloc(sizeof(*rp) + 7, GFP_KERNEL);
3805+
if (!rp)
3806+
return -ENOMEM;
38053807

38063808
rp->num = 0;
38073809
if (!drvdata->isoc)

0 commit comments

Comments
 (0)