Commit 790bd7c4 authored by Jordan Yates's avatar Jordan Yates Committed by Dan Kalowsky
Browse files

bluetooth: host: hci_core: add missing `NULL` check

Add check that the command buffer claimed in `bt_le_create_conn_cancel`
is not `NULL`. Fixes a fault caused by providing the `NULL` buffer to
`bt_hci_cmd_state_set_init`.

Signed-off-by: default avatarJordan Yates <jordan@embeint.com>
parent c2ad6633
Loading
Loading
Loading
Loading
+3 −0
Changes for subsys/bluetooth/host/hci_core.c: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -891,6 +891,9 @@ int bt_le_create_conn_cancel(void)
	struct bt_hci_cmd_state_set state;

	buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_CONN_CANCEL, 0);
	if (!buf) {
		return -ENOBUFS;
	}

	bt_hci_cmd_state_set_init(buf, &state, bt_dev.flags,
				  BT_DEV_INITIATING, false);