Skip to content

Commit 01c578f

Browse files
committed
Bluetooth: L2CAP: Fix build errors in some archs
jira VULN-155016 cve-pre CVE-2023-53305 commit-author Luiz Augusto von Dentz <luiz.von.dentz@intel.com> commit fc5ae5b This attempts to fix the follow errors: In function 'memcmp', inlined from 'bacmp' at ./include/net/bluetooth/bluetooth.h:347:9, inlined from 'l2cap_global_chan_by_psm' at net/bluetooth/l2cap_core.c:2003:15: ./include/linux/fortify-string.h:44:33: error: '__builtin_memcmp' specified bound 6 exceeds source size 0 [-Werror=stringop-overread] 44 | #define __underlying_memcmp __builtin_memcmp | ^ ./include/linux/fortify-string.h:420:16: note: in expansion of macro '__underlying_memcmp' 420 | return __underlying_memcmp(p, q, size); | ^~~~~~~~~~~~~~~~~~~ In function 'memcmp', inlined from 'bacmp' at ./include/net/bluetooth/bluetooth.h:347:9, inlined from 'l2cap_global_chan_by_psm' at net/bluetooth/l2cap_core.c:2004:15: ./include/linux/fortify-string.h:44:33: error: '__builtin_memcmp' specified bound 6 exceeds source size 0 [-Werror=stringop-overread] 44 | #define __underlying_memcmp __builtin_memcmp | ^ ./include/linux/fortify-string.h:420:16: note: in expansion of macro '__underlying_memcmp' 420 | return __underlying_memcmp(p, q, size); | ^~~~~~~~~~~~~~~~~~~ Fixes: 332f179 ("Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm regression") Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> (cherry picked from commit fc5ae5b) Signed-off-by: Roxana Nicolescu <rnicolescu@ciq.com>
1 parent e03af71 commit 01c578f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

net/bluetooth/l2cap_core.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1991,11 +1991,11 @@ static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm,
19911991
src_match = !bacmp(&c->src, src);
19921992
dst_match = !bacmp(&c->dst, dst);
19931993
if (src_match && dst_match) {
1994-
c = l2cap_chan_hold_unless_zero(c);
1995-
if (c) {
1996-
read_unlock(&chan_list_lock);
1997-
return c;
1998-
}
1994+
if (!l2cap_chan_hold_unless_zero(c))
1995+
continue;
1996+
1997+
read_unlock(&chan_list_lock);
1998+
return c;
19991999
}
20002000

20012001
/* Closest match */

0 commit comments

Comments
 (0)