Skip to content

Commit 1e03a06

Browse files
Johan Hedbergnashif
authored andcommitted
Bluetooth: Fix NULL pointer dereference when bt_send() fails
The last parameter to hci_cmd_done() is expected to be a valid net_buf since the function immediately tries to dereference it. Fix this by passing the appropriate buffer reference to the function. Signed-off-by: Johan Hedberg <[email protected]>
1 parent a14ee05 commit 1e03a06

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

subsys/bluetooth/host/hci_core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3644,8 +3644,7 @@ static void send_cmd(void)
36443644
if (err) {
36453645
BT_ERR("Unable to send to driver (err %d)", err);
36463646
k_sem_give(&bt_dev.ncmd_sem);
3647-
hci_cmd_done(cmd(buf)->opcode, BT_HCI_ERR_UNSPECIFIED,
3648-
NULL);
3647+
hci_cmd_done(cmd(buf)->opcode, BT_HCI_ERR_UNSPECIFIED, buf);
36493648
net_buf_unref(bt_dev.sent_cmd);
36503649
bt_dev.sent_cmd = NULL;
36513650
net_buf_unref(buf);

0 commit comments

Comments
 (0)