|
|
65e7f7 |
From 5fe8bfedd40a614374fdcb430694de00aedae2c5 Mon Sep 17 00:00:00 2001
|
|
|
65e7f7 |
From: Joe Lawrence <joe.lawrence@redhat.com>
|
|
|
65e7f7 |
Date: Thu, 18 Jan 2024 09:42:47 -0500
|
|
|
65e7f7 |
Subject: [KPATCH CVE-2022-42896] kpatch fixes for CVE-2022-42896
|
|
|
65e7f7 |
MIME-Version: 1.0
|
|
|
65e7f7 |
Content-Type: text/plain; charset=UTF-8
|
|
|
65e7f7 |
Content-Transfer-Encoding: 8bit
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Kernels:
|
|
|
65e7f7 |
3.10.0-1160.95.1.el7
|
|
|
65e7f7 |
3.10.0-1160.99.1.el7
|
|
|
65e7f7 |
3.10.0-1160.102.1.el7
|
|
|
65e7f7 |
3.10.0-1160.105.1.el7
|
|
|
65e7f7 |
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Kpatch-MR: https://gitlab.com/redhat/prdsc/rhel/src/kpatch/rhel-7/-/merge_requests/66
|
|
|
65e7f7 |
Changes since last build:
|
|
|
65e7f7 |
[x86_64]:
|
|
|
65e7f7 |
igb_main.o: changed function: igb_configure
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_chan_hold
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_conn_get
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_global_chan_by_psm
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_recv_frame
|
|
|
65e7f7 |
l2cap_core.o: new function: klp_l2cap_le_sig_cmd
|
|
|
65e7f7 |
sch_atm.o: changed function: atm_tc_peek
|
|
|
65e7f7 |
sch_atm.o: changed function: sch_atm_dequeue
|
|
|
65e7f7 |
sch_drr.o: changed function: drr_dequeue
|
|
|
65e7f7 |
sch_dsmark.o: changed function: dsmark_peek
|
|
|
65e7f7 |
sch_hfsc.o: changed function: hfsc_enqueue
|
|
|
65e7f7 |
sch_hfsc.o: changed function: qdisc_peek_len
|
|
|
65e7f7 |
sch_multiq.o: changed function: multiq_peek
|
|
|
65e7f7 |
sch_prio.o: changed function: prio_peek
|
|
|
65e7f7 |
sch_qfq.o: changed function: qfq_dequeue
|
|
|
65e7f7 |
sch_qfq.o: changed function: qfq_enqueue
|
|
|
65e7f7 |
sch_red.o: changed function: red_peek
|
|
|
65e7f7 |
sch_sfb.o: changed function: sfb_peek
|
|
|
65e7f7 |
sch_tbf.o: changed function: tbf_dequeue
|
|
|
65e7f7 |
|
|
|
65e7f7 |
[ppc64le]:
|
|
|
65e7f7 |
l2cap_core.o: changed function: __l2cap_chan_add
|
|
|
65e7f7 |
l2cap_core.o: changed function: __l2cap_physical_cfm
|
|
|
65e7f7 |
l2cap_core.o: changed function: __set_monitor_timer
|
|
|
65e7f7 |
l2cap_core.o: changed function: __set_retrans_timer.part.24
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_ack_timeout
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_build_conf_req
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_chan_busy
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_chan_close
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_chan_connect
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_chan_del
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_chan_hold
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_chan_put
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_chan_send
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_chan_timeout
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_conn_add.part.28
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_conn_del
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_conn_start
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_connect
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_connect_cfm
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_connect_create_rsp
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_data_channel
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_disconn_cfm
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_do_create
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_do_start
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_ertm_resend
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_ertm_send
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_global_fixed_chan
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_handle_rej
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_handle_srej
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_logical_cfm
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_monitor_timeout
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_move_done
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_move_setup
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_parse_conf_rsp.constprop.36
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_pass_to_tx
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_process_reqseq
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_recv_frame
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_retrans_timeout
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_retransmit_all
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_rx
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_rx_state_recv
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_security_cfm
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_send_ack
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_send_efs_conf_rsp
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_send_i_or_rr_or_rnr
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_send_move_chan_cfm
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_send_move_chan_cfm_icid
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_send_move_chan_req
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_send_rr_or_rnr
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_send_sframe
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_send_srej
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_send_srej_tail
|
|
|
65e7f7 |
l2cap_core.o: changed function: l2cap_start_connection
|
|
|
65e7f7 |
l2cap_core.o: new function: l2cap_connect_req
|
|
|
65e7f7 |
sch_atm.o: changed function: atm_tc_bind_filter
|
|
|
65e7f7 |
sch_atm.o: changed function: atm_tc_change
|
|
|
65e7f7 |
sch_atm.o: changed function: atm_tc_delete
|
|
|
65e7f7 |
sch_atm.o: changed function: atm_tc_destroy
|
|
|
65e7f7 |
sch_atm.o: changed function: atm_tc_enqueue
|
|
|
65e7f7 |
sch_atm.o: changed function: atm_tc_find
|
|
|
65e7f7 |
sch_atm.o: changed function: atm_tc_graft
|
|
|
65e7f7 |
sch_atm.o: changed function: atm_tc_leaf
|
|
|
65e7f7 |
sch_atm.o: changed function: atm_tc_peek
|
|
|
65e7f7 |
sch_atm.o: changed function: atm_tc_put
|
|
|
65e7f7 |
sch_atm.o: changed function: atm_tc_reset
|
|
|
65e7f7 |
sch_atm.o: changed function: atm_tc_tcf_block
|
|
|
65e7f7 |
sch_atm.o: changed function: sch_atm_dequeue
|
|
|
65e7f7 |
sch_drr.o: changed function: drr_dequeue
|
|
|
65e7f7 |
sch_dsmark.o: changed function: dsmark_bind_filter
|
|
|
65e7f7 |
sch_dsmark.o: changed function: dsmark_change
|
|
|
65e7f7 |
sch_dsmark.o: changed function: dsmark_destroy
|
|
|
65e7f7 |
sch_dsmark.o: changed function: dsmark_dump_class
|
|
|
65e7f7 |
sch_dsmark.o: changed function: dsmark_init
|
|
|
65e7f7 |
sch_dsmark.o: changed function: dsmark_peek
|
|
|
65e7f7 |
sch_dsmark.o: changed function: dsmark_reset
|
|
|
65e7f7 |
sch_hfsc.o: changed function: hfsc_change_class
|
|
|
65e7f7 |
sch_hfsc.o: changed function: hfsc_dequeue
|
|
|
65e7f7 |
sch_hfsc.o: changed function: hfsc_enqueue
|
|
|
65e7f7 |
sch_multiq.o: changed function: multiq_peek
|
|
|
65e7f7 |
sch_prio.o: changed function: prio_peek
|
|
|
65e7f7 |
sch_qfq.o: changed function: qfq_dequeue
|
|
|
65e7f7 |
sch_qfq.o: changed function: qfq_enqueue
|
|
|
65e7f7 |
sch_red.o: changed function: red_peek
|
|
|
65e7f7 |
sch_sfb.o: changed function: sfb_peek
|
|
|
65e7f7 |
sch_tbf.o: changed function: tbf_dequeue
|
|
|
65e7f7 |
|
|
|
65e7f7 |
---------------------------
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Modifications:
|
|
|
65e7f7 |
- function l2cap_le_sig_cmd has no fentry/mcount call, so add a "klp_"
|
|
|
65e7f7 |
prefix to the patched version and its callers
|
|
|
65e7f7 |
- for ppc64le, add __attribute__((optimize("-fno-optimize-sibling-calls")))
|
|
|
65e7f7 |
l2cap_chan_hold()
|
|
|
65e7f7 |
l2cap_disconn_cfm()
|
|
|
65e7f7 |
l2cap_handle_rej()
|
|
|
65e7f7 |
l2cap_handle_srej()
|
|
|
65e7f7 |
l2cap_monitor_timeout()
|
|
|
65e7f7 |
l2cap_pass_to_tx()
|
|
|
65e7f7 |
l2cap_retransmit_all()
|
|
|
65e7f7 |
l2cap_send_efs_conf_rsp()
|
|
|
65e7f7 |
l2cap_send_sframe()
|
|
|
65e7f7 |
|
|
|
65e7f7 |
commit d8f15b60a96ba8ce5d3d55518eb939d9bebd87a9
|
|
|
65e7f7 |
Author: David Marlin <dmarlin@redhat.com>
|
|
|
65e7f7 |
Date: Tue Jan 9 23:44:57 2024 -0600
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Bluetooth: L2CAP: Fix L2CAP_CR_SCID_IN_USE value
|
|
|
65e7f7 |
|
|
|
65e7f7 |
JIRA: https://issues.redhat.com/browse/RHEL-2742
|
|
|
65e7f7 |
CVE: CVE-2022-42896
|
|
|
65e7f7 |
|
|
|
65e7f7 |
commit d8edd9ed156a1a840f1b1c2dbbf458684d6eea6e
|
|
|
65e7f7 |
Author: Marcin Kraglak <marcin.kraglak@tieto.com>
|
|
|
65e7f7 |
Date: Wed Mar 8 14:09:41 2017 +0100
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Bluetooth: L2CAP: Fix L2CAP_CR_SCID_IN_USE value
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Fix issue found during L2CAP qualification test TP/LE/CFC/BV-20-C.
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Signed-off-by: Marcin Kraglak <marcin.kraglak@tieto.com>
|
|
|
65e7f7 |
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Signed-off-by: David Marlin <dmarlin@redhat.com>
|
|
|
65e7f7 |
|
|
|
65e7f7 |
commit ae6cdce73d24b5cdccb89f88552bd6a9074f0aed
|
|
|
65e7f7 |
Author: David Marlin <dmarlin@redhat.com>
|
|
|
65e7f7 |
Date: Tue Jan 9 23:45:05 2024 -0600
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Bluetooth: Use separate L2CAP LE credit based connection result values
|
|
|
65e7f7 |
|
|
|
65e7f7 |
JIRA: https://issues.redhat.com/browse/RHEL-2742
|
|
|
65e7f7 |
CVE: CVE-2022-42896
|
|
|
65e7f7 |
|
|
|
65e7f7 |
commit 571f739083e2544b343b5998608de679519de4e9
|
|
|
65e7f7 |
Author: Mallikarjun Phulari <mallikarjun.phulari@intel.com>
|
|
|
65e7f7 |
Date: Fri Oct 5 14:48:12 2018 +0530
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Bluetooth: Use separate L2CAP LE credit based connection result values
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Add the result values specific to L2CAP LE credit based connections
|
|
|
65e7f7 |
and change the old result values wherever they were used.
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Signed-off-by: Mallikarjun Phulari <mallikarjun.phulari@intel.com>
|
|
|
65e7f7 |
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Signed-off-by: David Marlin <dmarlin@redhat.com>
|
|
|
65e7f7 |
|
|
|
65e7f7 |
commit b45513e7819c6d7fe8bcd8bcf94670e0da9cc949
|
|
|
65e7f7 |
Author: David Marlin <dmarlin@redhat.com>
|
|
|
65e7f7 |
Date: Tue Jan 9 23:46:25 2024 -0600
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Bluetooth: L2CAP: Fix accepting connection request for invalid SPSM
|
|
|
65e7f7 |
|
|
|
65e7f7 |
JIRA: https://issues.redhat.com/browse/RHEL-2742
|
|
|
65e7f7 |
|
|
|
65e7f7 |
CVE: CVE-2022-42896
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Conflicts:
|
|
|
65e7f7 |
Our 3.10 tree does not include support for Bluetooth Enhanced Credit Based Mode,
|
|
|
65e7f7 |
so omit hunk #2 of:
|
|
|
65e7f7 |
711f8c3fb3db Bluetooth: L2CAP: Fix accepting connection request for invalid SPSM
|
|
|
65e7f7 |
|
|
|
65e7f7 |
commit 711f8c3fb3db61897080468586b970c87c61d9e4
|
|
|
65e7f7 |
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
|
|
|
65e7f7 |
Date: Mon Oct 31 16:10:32 2022 -0700
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Bluetooth: L2CAP: Fix accepting connection request for invalid SPSM
|
|
|
65e7f7 |
|
|
|
65e7f7 |
The Bluetooth spec states that the valid range for SPSM is from
|
|
|
65e7f7 |
0x0001-0x00ff so it is invalid to accept values outside of this range:
|
|
|
65e7f7 |
|
|
|
65e7f7 |
BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 3, Part A
|
|
|
65e7f7 |
page 1059:
|
|
|
65e7f7 |
Table 4.15: L2CAP_LE_CREDIT_BASED_CONNECTION_REQ SPSM ranges
|
|
|
65e7f7 |
|
|
|
65e7f7 |
CVE: CVE-2022-42896
|
|
|
65e7f7 |
CC: stable@vger.kernel.org
|
|
|
65e7f7 |
Reported-by: Tamás Koczka <poprdi@google.com>
|
|
|
65e7f7 |
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
|
|
|
65e7f7 |
Reviewed-by: Tedd Ho-Jeong An <tedd.an@intel.com>
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Signed-off-by: David Marlin <dmarlin@redhat.com>
|
|
|
65e7f7 |
|
|
|
65e7f7 |
commit a766b7a5d576eb559319776f8fa400f00128937e
|
|
|
65e7f7 |
Author: David Marlin <dmarlin@redhat.com>
|
|
|
65e7f7 |
Date: Tue Jan 9 23:47:13 2024 -0600
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm
|
|
|
65e7f7 |
|
|
|
65e7f7 |
JIRA: https://issues.redhat.com/browse/RHEL-2742
|
|
|
65e7f7 |
CVE: CVE-2022-42896
|
|
|
65e7f7 |
|
|
|
65e7f7 |
commit f937b758a188d6fd328a81367087eddbb2fce50f
|
|
|
65e7f7 |
Author: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
|
|
|
65e7f7 |
Date: Mon Oct 31 16:10:33 2022 -0700
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm
|
|
|
65e7f7 |
|
|
|
65e7f7 |
l2cap_global_chan_by_psm shall not return fixed channels as they are not
|
|
|
65e7f7 |
meant to be connected by (S)PSM.
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
|
|
|
65e7f7 |
Reviewed-by: Tedd Ho-Jeong An <tedd.an@intel.com>
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Signed-off-by: David Marlin <dmarlin@redhat.com>
|
|
|
65e7f7 |
|
|
|
65e7f7 |
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
|
|
|
65e7f7 |
---
|
|
|
65e7f7 |
include/net/bluetooth/l2cap.h | 17 +++++++----
|
|
|
65e7f7 |
net/bluetooth/l2cap_core.c | 55 +++++++++++++++++++++++++----------
|
|
|
65e7f7 |
2 files changed, 50 insertions(+), 22 deletions(-)
|
|
|
65e7f7 |
|
|
|
65e7f7 |
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
|
|
|
65e7f7 |
index 45f3a951974c..1b0dfbb0eb82 100644
|
|
|
65e7f7 |
--- a/include/net/bluetooth/l2cap.h
|
|
|
65e7f7 |
+++ b/include/net/bluetooth/l2cap.h
|
|
|
65e7f7 |
@@ -277,12 +277,17 @@ struct l2cap_conn_rsp {
|
|
|
65e7f7 |
#define L2CAP_CR_SEC_BLOCK 0x0003
|
|
|
65e7f7 |
#define L2CAP_CR_NO_MEM 0x0004
|
|
|
65e7f7 |
#define L2CAP_CR_BAD_AMP 0x0005
|
|
|
65e7f7 |
-#define L2CAP_CR_AUTHENTICATION 0x0005
|
|
|
65e7f7 |
-#define L2CAP_CR_AUTHORIZATION 0x0006
|
|
|
65e7f7 |
-#define L2CAP_CR_BAD_KEY_SIZE 0x0007
|
|
|
65e7f7 |
-#define L2CAP_CR_ENCRYPTION 0x0008
|
|
|
65e7f7 |
-#define L2CAP_CR_INVALID_SCID 0x0009
|
|
|
65e7f7 |
-#define L2CAP_CR_SCID_IN_USE 0x0010
|
|
|
65e7f7 |
+
|
|
|
65e7f7 |
+/* credit based connect results */
|
|
|
65e7f7 |
+#define L2CAP_CR_LE_SUCCESS 0x0000
|
|
|
65e7f7 |
+#define L2CAP_CR_LE_BAD_PSM 0x0002
|
|
|
65e7f7 |
+#define L2CAP_CR_LE_NO_MEM 0x0004
|
|
|
65e7f7 |
+#define L2CAP_CR_LE_AUTHENTICATION 0x0005
|
|
|
65e7f7 |
+#define L2CAP_CR_LE_AUTHORIZATION 0x0006
|
|
|
65e7f7 |
+#define L2CAP_CR_LE_BAD_KEY_SIZE 0x0007
|
|
|
65e7f7 |
+#define L2CAP_CR_LE_ENCRYPTION 0x0008
|
|
|
65e7f7 |
+#define L2CAP_CR_LE_INVALID_SCID 0x0009
|
|
|
65e7f7 |
+#define L2CAP_CR_LE_SCID_IN_USE 0X000A
|
|
|
65e7f7 |
|
|
|
65e7f7 |
/* connect/create channel status */
|
|
|
65e7f7 |
#define L2CAP_CS_NO_INFO 0x0000
|
|
|
65e7f7 |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
|
|
|
65e7f7 |
index 4338810b0d58..a3bed86517e7 100644
|
|
|
65e7f7 |
--- a/net/bluetooth/l2cap_core.c
|
|
|
65e7f7 |
+++ b/net/bluetooth/l2cap_core.c
|
|
|
65e7f7 |
@@ -480,6 +480,7 @@ static void l2cap_chan_destroy(struct kref *kref)
|
|
|
65e7f7 |
kfree(chan);
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
+__attribute__((optimize("-fno-optimize-sibling-calls")))
|
|
|
65e7f7 |
void l2cap_chan_hold(struct l2cap_chan *c)
|
|
|
65e7f7 |
{
|
|
|
65e7f7 |
BT_DBG("chan %p orig refcnt %d", c, kref_read(&c->kref));
|
|
|
65e7f7 |
@@ -682,9 +683,9 @@ static void l2cap_chan_le_connect_reject(struct l2cap_chan *chan)
|
|
|
65e7f7 |
u16 result;
|
|
|
65e7f7 |
|
|
|
65e7f7 |
if (test_bit(FLAG_DEFER_SETUP, &chan->flags))
|
|
|
65e7f7 |
- result = L2CAP_CR_AUTHORIZATION;
|
|
|
65e7f7 |
+ result = L2CAP_CR_LE_AUTHORIZATION;
|
|
|
65e7f7 |
else
|
|
|
65e7f7 |
- result = L2CAP_CR_BAD_PSM;
|
|
|
65e7f7 |
+ result = L2CAP_CR_LE_BAD_PSM;
|
|
|
65e7f7 |
|
|
|
65e7f7 |
l2cap_state_change(chan, BT_DISCONN);
|
|
|
65e7f7 |
|
|
|
65e7f7 |
@@ -1067,6 +1068,7 @@ static struct sk_buff *l2cap_create_sframe_pdu(struct l2cap_chan *chan,
|
|
|
65e7f7 |
return skb;
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
+__attribute__((optimize("-fno-optimize-sibling-calls")))
|
|
|
65e7f7 |
static void l2cap_send_sframe(struct l2cap_chan *chan,
|
|
|
65e7f7 |
struct l2cap_ctrl *control)
|
|
|
65e7f7 |
{
|
|
|
65e7f7 |
@@ -1792,7 +1794,7 @@ static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm,
|
|
|
65e7f7 |
if (link_type == LE_LINK && c->src_type == BDADDR_BREDR)
|
|
|
65e7f7 |
continue;
|
|
|
65e7f7 |
|
|
|
65e7f7 |
- if (c->psm == psm) {
|
|
|
65e7f7 |
+ if (c->chan_type != L2CAP_CHAN_FIXED && c->psm == psm) {
|
|
|
65e7f7 |
int src_match, dst_match;
|
|
|
65e7f7 |
int src_any, dst_any;
|
|
|
65e7f7 |
|
|
|
65e7f7 |
@@ -1822,6 +1824,7 @@ static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm,
|
|
|
65e7f7 |
return c1;
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
+__attribute__((optimize("-fno-optimize-sibling-calls")))
|
|
|
65e7f7 |
static void l2cap_monitor_timeout(struct work_struct *work)
|
|
|
65e7f7 |
{
|
|
|
65e7f7 |
struct l2cap_chan *chan = container_of(work, struct l2cap_chan,
|
|
|
65e7f7 |
@@ -2062,6 +2065,7 @@ static void l2cap_retransmit(struct l2cap_chan *chan,
|
|
|
65e7f7 |
l2cap_ertm_resend(chan);
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
+__attribute__((optimize("-fno-optimize-sibling-calls")))
|
|
|
65e7f7 |
static void l2cap_retransmit_all(struct l2cap_chan *chan,
|
|
|
65e7f7 |
struct l2cap_ctrl *control)
|
|
|
65e7f7 |
{
|
|
|
65e7f7 |
@@ -2862,6 +2866,7 @@ static void l2cap_tx(struct l2cap_chan *chan, struct l2cap_ctrl *control,
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
+__attribute__((optimize("-fno-optimize-sibling-calls")))
|
|
|
65e7f7 |
static void l2cap_pass_to_tx(struct l2cap_chan *chan,
|
|
|
65e7f7 |
struct l2cap_ctrl *control)
|
|
|
65e7f7 |
{
|
|
|
65e7f7 |
@@ -3702,7 +3707,7 @@ void __l2cap_le_connect_rsp_defer(struct l2cap_chan *chan)
|
|
|
65e7f7 |
rsp.mtu = cpu_to_le16(chan->imtu);
|
|
|
65e7f7 |
rsp.mps = cpu_to_le16(chan->mps);
|
|
|
65e7f7 |
rsp.credits = cpu_to_le16(chan->rx_credits);
|
|
|
65e7f7 |
- rsp.result = cpu_to_le16(L2CAP_CR_SUCCESS);
|
|
|
65e7f7 |
+ rsp.result = cpu_to_le16(L2CAP_CR_LE_SUCCESS);
|
|
|
65e7f7 |
|
|
|
65e7f7 |
l2cap_send_cmd(conn, chan->ident, L2CAP_LE_CONN_RSP, sizeof(rsp),
|
|
|
65e7f7 |
&rsp;;
|
|
|
65e7f7 |
@@ -4055,6 +4060,8 @@ static inline void set_default_fcs(struct l2cap_chan *chan)
|
|
|
65e7f7 |
chan->fcs = L2CAP_FCS_CRC16;
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
+
|
|
|
65e7f7 |
+__attribute__((optimize("-fno-optimize-sibling-calls")))
|
|
|
65e7f7 |
static void l2cap_send_efs_conf_rsp(struct l2cap_chan *chan, void *data,
|
|
|
65e7f7 |
u8 ident, u16 flags)
|
|
|
65e7f7 |
{
|
|
|
65e7f7 |
@@ -5318,7 +5325,7 @@ static int l2cap_le_connect_rsp(struct l2cap_conn *conn,
|
|
|
65e7f7 |
credits = __le16_to_cpu(rsp->credits);
|
|
|
65e7f7 |
result = __le16_to_cpu(rsp->result);
|
|
|
65e7f7 |
|
|
|
65e7f7 |
- if (result == L2CAP_CR_SUCCESS && (mtu < 23 || mps < 23 ||
|
|
|
65e7f7 |
+ if (result == L2CAP_CR_LE_SUCCESS && (mtu < 23 || mps < 23 ||
|
|
|
65e7f7 |
dcid < L2CAP_CID_DYN_START ||
|
|
|
65e7f7 |
dcid > L2CAP_CID_LE_DYN_END))
|
|
|
65e7f7 |
return -EPROTO;
|
|
|
65e7f7 |
@@ -5339,7 +5346,7 @@ static int l2cap_le_connect_rsp(struct l2cap_conn *conn,
|
|
|
65e7f7 |
l2cap_chan_lock(chan);
|
|
|
65e7f7 |
|
|
|
65e7f7 |
switch (result) {
|
|
|
65e7f7 |
- case L2CAP_CR_SUCCESS:
|
|
|
65e7f7 |
+ case L2CAP_CR_LE_SUCCESS:
|
|
|
65e7f7 |
if (__l2cap_get_chan_by_dcid(conn, dcid)) {
|
|
|
65e7f7 |
err = -EBADSLT;
|
|
|
65e7f7 |
break;
|
|
|
65e7f7 |
@@ -5353,8 +5360,8 @@ static int l2cap_le_connect_rsp(struct l2cap_conn *conn,
|
|
|
65e7f7 |
l2cap_chan_ready(chan);
|
|
|
65e7f7 |
break;
|
|
|
65e7f7 |
|
|
|
65e7f7 |
- case L2CAP_CR_AUTHENTICATION:
|
|
|
65e7f7 |
- case L2CAP_CR_ENCRYPTION:
|
|
|
65e7f7 |
+ case L2CAP_CR_LE_AUTHENTICATION:
|
|
|
65e7f7 |
+ case L2CAP_CR_LE_ENCRYPTION:
|
|
|
65e7f7 |
/* If we already have MITM protection we can't do
|
|
|
65e7f7 |
* anything.
|
|
|
65e7f7 |
*/
|
|
|
65e7f7 |
@@ -5493,11 +5500,24 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,
|
|
|
65e7f7 |
BT_DBG("psm 0x%2.2x scid 0x%4.4x mtu %u mps %u", __le16_to_cpu(psm),
|
|
|
65e7f7 |
scid, mtu, mps);
|
|
|
65e7f7 |
|
|
|
65e7f7 |
+ /* BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 3, Part A
|
|
|
65e7f7 |
+ * page 1059:
|
|
|
65e7f7 |
+ *
|
|
|
65e7f7 |
+ * Valid range: 0x0001-0x00ff
|
|
|
65e7f7 |
+ *
|
|
|
65e7f7 |
+ * Table 4.15: L2CAP_LE_CREDIT_BASED_CONNECTION_REQ SPSM ranges
|
|
|
65e7f7 |
+ */
|
|
|
65e7f7 |
+ if (!psm || __le16_to_cpu(psm) > L2CAP_PSM_LE_DYN_END) {
|
|
|
65e7f7 |
+ result = L2CAP_CR_LE_BAD_PSM;
|
|
|
65e7f7 |
+ chan = NULL;
|
|
|
65e7f7 |
+ goto response;
|
|
|
65e7f7 |
+ }
|
|
|
65e7f7 |
+
|
|
|
65e7f7 |
/* Check if we have socket listening on psm */
|
|
|
65e7f7 |
pchan = l2cap_global_chan_by_psm(BT_LISTEN, psm, &conn->hcon->src,
|
|
|
65e7f7 |
&conn->hcon->dst, LE_LINK);
|
|
|
65e7f7 |
if (!pchan) {
|
|
|
65e7f7 |
- result = L2CAP_CR_BAD_PSM;
|
|
|
65e7f7 |
+ result = L2CAP_CR_LE_BAD_PSM;
|
|
|
65e7f7 |
chan = NULL;
|
|
|
65e7f7 |
goto response;
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
@@ -5507,28 +5527,28 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,
|
|
|
65e7f7 |
|
|
|
65e7f7 |
if (!smp_sufficient_security(conn->hcon, pchan->sec_level,
|
|
|
65e7f7 |
SMP_ALLOW_STK)) {
|
|
|
65e7f7 |
- result = L2CAP_CR_AUTHENTICATION;
|
|
|
65e7f7 |
+ result = L2CAP_CR_LE_AUTHENTICATION;
|
|
|
65e7f7 |
chan = NULL;
|
|
|
65e7f7 |
goto response_unlock;
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
/* Check for valid dynamic CID range */
|
|
|
65e7f7 |
if (scid < L2CAP_CID_DYN_START || scid > L2CAP_CID_LE_DYN_END) {
|
|
|
65e7f7 |
- result = L2CAP_CR_INVALID_SCID;
|
|
|
65e7f7 |
+ result = L2CAP_CR_LE_INVALID_SCID;
|
|
|
65e7f7 |
chan = NULL;
|
|
|
65e7f7 |
goto response_unlock;
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
/* Check if we already have channel with that dcid */
|
|
|
65e7f7 |
if (__l2cap_get_chan_by_dcid(conn, scid)) {
|
|
|
65e7f7 |
- result = L2CAP_CR_SCID_IN_USE;
|
|
|
65e7f7 |
+ result = L2CAP_CR_LE_SCID_IN_USE;
|
|
|
65e7f7 |
chan = NULL;
|
|
|
65e7f7 |
goto response_unlock;
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
chan = pchan->ops->new_connection(pchan);
|
|
|
65e7f7 |
if (!chan) {
|
|
|
65e7f7 |
- result = L2CAP_CR_NO_MEM;
|
|
|
65e7f7 |
+ result = L2CAP_CR_LE_NO_MEM;
|
|
|
65e7f7 |
goto response_unlock;
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
@@ -5563,7 +5583,7 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,
|
|
|
65e7f7 |
chan->ops->defer(chan);
|
|
|
65e7f7 |
} else {
|
|
|
65e7f7 |
l2cap_chan_ready(chan);
|
|
|
65e7f7 |
- result = L2CAP_CR_SUCCESS;
|
|
|
65e7f7 |
+ result = L2CAP_CR_LE_SUCCESS;
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
response_unlock:
|
|
|
65e7f7 |
@@ -5665,7 +5685,7 @@ done:
|
|
|
65e7f7 |
return 0;
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
-static inline int l2cap_le_sig_cmd(struct l2cap_conn *conn,
|
|
|
65e7f7 |
+static inline int klp_l2cap_le_sig_cmd(struct l2cap_conn *conn,
|
|
|
65e7f7 |
struct l2cap_cmd_hdr *cmd, u16 cmd_len,
|
|
|
65e7f7 |
u8 *data)
|
|
|
65e7f7 |
{
|
|
|
65e7f7 |
@@ -5738,7 +5758,7 @@ static inline void l2cap_le_sig_channel(struct l2cap_conn *conn,
|
|
|
65e7f7 |
goto drop;
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
- err = l2cap_le_sig_cmd(conn, cmd, len, skb->data);
|
|
|
65e7f7 |
+ err = klp_l2cap_le_sig_cmd(conn, cmd, len, skb->data);
|
|
|
65e7f7 |
if (err) {
|
|
|
65e7f7 |
struct l2cap_cmd_rej_unk rej;
|
|
|
65e7f7 |
|
|
|
65e7f7 |
@@ -6012,6 +6032,7 @@ static int l2cap_rx_queued_iframes(struct l2cap_chan *chan)
|
|
|
65e7f7 |
return err;
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
+__attribute__((optimize("-fno-optimize-sibling-calls")))
|
|
|
65e7f7 |
static void l2cap_handle_srej(struct l2cap_chan *chan,
|
|
|
65e7f7 |
struct l2cap_ctrl *control)
|
|
|
65e7f7 |
{
|
|
|
65e7f7 |
@@ -6070,6 +6091,7 @@ static void l2cap_handle_srej(struct l2cap_chan *chan,
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
+__attribute__((optimize("-fno-optimize-sibling-calls")))
|
|
|
65e7f7 |
static void l2cap_handle_rej(struct l2cap_chan *chan,
|
|
|
65e7f7 |
struct l2cap_ctrl *control)
|
|
|
65e7f7 |
{
|
|
|
65e7f7 |
@@ -7442,6 +7464,7 @@ int l2cap_disconn_ind(struct hci_conn *hcon)
|
|
|
65e7f7 |
return conn->disc_reason;
|
|
|
65e7f7 |
}
|
|
|
65e7f7 |
|
|
|
65e7f7 |
+__attribute__((optimize("-fno-optimize-sibling-calls")))
|
|
|
65e7f7 |
static void l2cap_disconn_cfm(struct hci_conn *hcon, u8 reason)
|
|
|
65e7f7 |
{
|
|
|
65e7f7 |
if (hcon->type != ACL_LINK && hcon->type != LE_LINK)
|
|
|
65e7f7 |
--
|
|
|
65e7f7 |
2.44.0
|
|
|
65e7f7 |
|
|
|
65e7f7 |
|