Blame SOURCES/CVE-2022-42896.patch

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