Bluetooth: Make handle of hci_conn be unique
authorZiyang Xuan <william.xuanziyang@huawei.com>
Wed, 11 Oct 2023 09:57:31 +0000 (17:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 20 Nov 2023 10:59:03 +0000 (11:59 +0100)
commit84cb0143fb8a03bf941c7aaedd56c938c99dafad
tree91aaad53632d6f01264476ec8a9983f970d9a20e
parent2341747553ef1e45469a33864c91e1dab0a46c5a
Bluetooth: Make handle of hci_conn be unique

[ Upstream commit 181a42edddf51d5d9697ecdf365d72ebeab5afb0 ]

The handle of new hci_conn is always HCI_CONN_HANDLE_MAX + 1 if
the handle of the first hci_conn entry in hci_dev->conn_hash->list
is not HCI_CONN_HANDLE_MAX + 1. Use ida to manage the allocation of
hci_conn->handle to make it be unique.

Fixes: 9f78191cc9f1 ("Bluetooth: hci_conn: Always allocate unique handles")
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/bluetooth/hci_core.h
net/bluetooth/amp.c
net/bluetooth/hci_conn.c
net/bluetooth/hci_core.c
net/bluetooth/hci_event.c