Bluetooth: use hdev lock for accept_list and reject_list in conn req
authorNiels Dossche <dossche.niels@gmail.com>
Tue, 5 Apr 2022 17:37:52 +0000 (19:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:22:58 +0000 (10:22 +0200)
commitce237c1e252d0dac506c93c9818f8085185355be
treed0763fe4321539092ee42eac81136d43997881d7
parentab00f8c6b14ed8360fc2c40bd2ec61c6477e2ddb
Bluetooth: use hdev lock for accept_list and reject_list in conn req

[ Upstream commit fb048cae51bacdfbbda2954af3c213fdb1d484f4 ]

All accesses (both reads and modifications) to
hdev->{accept,reject}_list are protected by hdev lock,
except the ones in hci_conn_request_evt. This can cause a race
condition in the form of a list corruption.
The solution is to protect these lists in hci_conn_request_evt as well.

I was unable to find the exact commit that introduced the issue for the
reject list, I was only able to find it for the accept list.

Fixes: a55bd29d5227 ("Bluetooth: Add white list lookup for incoming connection requests")
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/hci_event.c