Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 31 Oct 2022 23:10:33 +0000 (16:10 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Nov 2022 16:35:38 +0000 (17:35 +0100)
[ Upstream commit f937b758a188d6fd328a81367087eddbb2fce50f ]

l2cap_global_chan_by_psm shall not return fixed channels as they are not
meant to be connected by (S)PSM.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Reviewed-by: Tedd Ho-Jeong An <tedd.an@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/l2cap_core.c

index 6933449840359253310b7a38e6dc70a5aae52333..c230f89e7238cf3d26fda2fe9d6da53f828a9392 100644 (file)
@@ -1824,7 +1824,7 @@ static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm,
                if (link_type == LE_LINK && c->src_type == BDADDR_BREDR)
                        continue;
 
-               if (c->psm == psm) {
+               if (c->chan_type != L2CAP_CHAN_FIXED && c->psm == psm) {
                        int src_match, dst_match;
                        int src_any, dst_any;