Skip to content

Commit b1a2cd5

Browse files
committed
Bluetooth: L2CAP: Fix attempting to access uninitialized memory
On l2cap_parse_conf_req the variable efs is only initialized if remote_efs has been set. CVE: CVE-2022-42895 CC: stable@vger.kernel.org Reported-by: Tamás Koczka <poprdi@google.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Reviewed-by: Tedd Ho-Jeong An <tedd.an@intel.com>
1 parent f937b75 commit b1a2cd5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/bluetooth/l2cap_core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3764,7 +3764,8 @@ static int l2cap_parse_conf_req(struct l2cap_chan *chan, void *data, size_t data
37643764
l2cap_add_conf_opt(&ptr, L2CAP_CONF_RFC,
37653765
sizeof(rfc), (unsigned long) &rfc, endptr - ptr);
37663766

3767-
if (test_bit(FLAG_EFS_ENABLE, &chan->flags)) {
3767+
if (remote_efs &&
3768+
test_bit(FLAG_EFS_ENABLE, &chan->flags)) {
37683769
chan->remote_id = efs.id;
37693770
chan->remote_stype = efs.stype;
37703771
chan->remote_msdu = le16_to_cpu(efs.msdu);

0 commit comments

Comments
 (0)