Bluetooth: L2CAP: Add missing checks for invalid DCID
authorSungwoo Kim <iam@sung-woo.kim>
Sat, 3 Jun 2023 12:28:09 +0000 (08:28 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 14 Jun 2023 09:15:18 +0000 (11:15 +0200)
commit3e8a7573ff9f43b76e7056b5ed32ea4b93e6ca10
treea52f05ca07b5f7c30bb012f2ac8187313048a3eb
parent66b3f7425a9c5ebc2174539a55ba4ccf4cf1272c
Bluetooth: L2CAP: Add missing checks for invalid DCID

[ Upstream commit 75767213f3d9b97f63694d02260b6a49a2271876 ]

When receiving a connect response we should make sure that the DCID is
within the valid range and that we don't already have another channel
allocated for the same DCID.
Missing checks may violate the specification (BLUETOOTH CORE SPECIFICATION
Version 5.4 | Vol 3, Part A, Page 1046).

Fixes: 40624183c202 ("Bluetooth: L2CAP: Add missing checks for invalid LE DCID")
Signed-off-by: Sungwoo Kim <iam@sung-woo.kim>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/l2cap_core.c