Skip to content

Commit dbfc2eb

Browse files
Johan Hedbergjhedberg
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 82083a9 commit dbfc2eb

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
@@ -4097,8 +4097,7 @@ static void send_cmd(void)
40974097
if (err) {
40984098
BT_ERR("Unable to send to driver (err %d)", err);
40994099
k_sem_give(&bt_dev.ncmd_sem);
4100-
hci_cmd_done(cmd(buf)->opcode, BT_HCI_ERR_UNSPECIFIED,
4101-
NULL);
4100+
hci_cmd_done(cmd(buf)->opcode, BT_HCI_ERR_UNSPECIFIED, buf);
41024101
net_buf_unref(bt_dev.sent_cmd);
41034102
bt_dev.sent_cmd = NULL;
41044103
net_buf_unref(buf);

0 commit comments

Comments
 (0)