From patchwork Sat Dec 3 17:48:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cengiz Can X-Patchwork-Id: 1711728 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=GObn+1BP; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NPcl33SY6z23pH for ; Sun, 4 Dec 2022 04:49:35 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1p1Wdi-0007Rw-BO; Sat, 03 Dec 2022 17:49:26 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1p1Wdf-0007N6-Ei for kernel-team@lists.ubuntu.com; Sat, 03 Dec 2022 17:49:23 +0000 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 18E7F3F1C3 for ; Sat, 3 Dec 2022 17:49:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1670089762; bh=NZjkmWZczWUNgp2tgRgIXFF8WWfFeLczg4dw6HZUsAo=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=GObn+1BPr0EPvH1t5klT0KJ/UDYLnKCn0ImxcBG5reLqGPuTRe8jeF38FL5MnHiOh DnFIURnerY4wAWbDA3QzKgR16g9zSjiwPDJusSHMiHt07UfP+lvtLTQqtwQiuQ46Rb R2HH8vb5ef8m9CGI33kBBacOoSpJ8Sjy3BI1qL8Dql23NVEeY7azTVjbtwuyeEBVLp yw6HSdbcO25QnV9w2OVS4snOzqT9+iHK1dn4CT4OxCID9sWJM5R4pTb2LOVclw09yZ xAiaBd9h0N2+lXg5IsjeGBotzYkuaXVuwp/RGh/MehbWpU1W/7Cv77S3JL09MlNWL4 Z0f1xXGvoqdlg== Received: by mail-wm1-f72.google.com with SMTP id e8-20020a05600c218800b003cf634f5280so2999598wme.8 for ; Sat, 03 Dec 2022 09:49:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NZjkmWZczWUNgp2tgRgIXFF8WWfFeLczg4dw6HZUsAo=; b=hFMN0vb5zOt906LSWQt6mjusUFzotpBscbFw6Z5SxQ4Qosgu9SbnXP3bf/UD2uEWFS B/J2idL4+DrBy5y5AhzU/LQotVmmcTktqKN+InVoy0NQenP2YvXuYa719BNw5Kz9Aqee PTaq4TeIfkL2Ph+Jy54ylT+4KORyGwAqLKtbIrrKMlLvW3Y+9jn3cWBiVRoEo7Pu8z1R CvoVYS4SXAB+fjmX1UxDVaqKXLiHIEti4FCDFPR8wkGfDAG6L8zJEXtOXJfo3hQ3ho2D 7jwK7gnxZ4DUxxDcvyZQ3jjeDM/bWmw3jJUSuH3KmvHEnJvPp7m1V+yP4nJzzit5equ2 cEmA== X-Gm-Message-State: ANoB5pm4HH0liQoVvaDTpX0UCSMpOZr/HXB0PJFhyef1AB7JyRv90TXY IWGglnwj8avadi/QtmVX9mRQRHBjwZMeIJxiCxyER6WOEkxjISdlcIp6lqoosF9NlHEtux9s14R Tl+laCS3g8EmlSqUe7oVRvHxydYLVwG14e/AfrEa0Hw== X-Received: by 2002:adf:d08c:0:b0:236:783e:5947 with SMTP id y12-20020adfd08c000000b00236783e5947mr45994303wrh.168.1670089761512; Sat, 03 Dec 2022 09:49:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf7xKQ7jCCze94QyuGwJoXJle9daVShZ8U32HASGof5Nptws5/FeP+kx33M/rSfY/9h2jZZ3/A== X-Received: by 2002:adf:d08c:0:b0:236:783e:5947 with SMTP id y12-20020adfd08c000000b00236783e5947mr45994299wrh.168.1670089761282; Sat, 03 Dec 2022 09:49:21 -0800 (PST) Received: from localhost ([92.44.145.54]) by smtp.gmail.com with ESMTPSA id e14-20020adff34e000000b0024228b0b932sm12196131wrp.27.2022.12.03.09.49.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Dec 2022 09:49:20 -0800 (PST) From: Cengiz Can To: kernel-team@lists.ubuntu.com Subject: [SRU Bionic v2 6/8] Bluetooth: L2CAP: Add definitions for Enhanced Credit Based Mode Date: Sat, 3 Dec 2022 20:48:41 +0300 Message-Id: <20221203174842.543278-7-cengiz.can@canonical.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221203174842.543278-1-cengiz.can@canonical.com> References: <20221203174842.543278-1-cengiz.can@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Luiz Augusto von Dentz This introduces the definitions for the new L2CAP mode called Enhanced Credit Based Mode. Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Marcel Holtmann CVE-2022-42896 (cherry picked from commit 145720963b6c68d0c4054112c09050995259b8f8) Signed-off-by: Cengiz Can --- include/net/bluetooth/l2cap.h | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h index 255a30597b12..ada682b8a37e 100644 --- a/include/net/bluetooth/l2cap.h +++ b/include/net/bluetooth/l2cap.h @@ -119,6 +119,10 @@ struct l2cap_conninfo { #define L2CAP_LE_CONN_REQ 0x14 #define L2CAP_LE_CONN_RSP 0x15 #define L2CAP_LE_CREDITS 0x16 +#define L2CAP_ECRED_CONN_REQ 0x17 +#define L2CAP_ECRED_CONN_RSP 0x18 +#define L2CAP_ECRED_RECONF_REQ 0x19 +#define L2CAP_ECRED_RECONF_RSP 0x1a /* L2CAP extended feature mask */ #define L2CAP_FEAT_FLOWCTL 0x00000001 @@ -359,6 +363,7 @@ struct l2cap_conf_rfc { * ever be used in the BR/EDR configuration phase. */ #define L2CAP_MODE_LE_FLOWCTL 0x80 +#define L2CAP_MODE_EXT_FLOWCTL 0x81 struct l2cap_conf_efs { __u8 id; @@ -483,6 +488,39 @@ struct l2cap_le_credits { __le16 credits; } __packed; +#define L2CAP_ECRED_MIN_MTU 64 +#define L2CAP_ECRED_MIN_MPS 64 + +struct l2cap_ecred_conn_req { + __le16 psm; + __le16 mtu; + __le16 mps; + __le16 credits; + __le16 scid[0]; +} __packed; + +struct l2cap_ecred_conn_rsp { + __le16 mtu; + __le16 mps; + __le16 credits; + __le16 result; + __le16 dcid[0]; +}; + +struct l2cap_ecred_reconf_req { + __le16 mtu; + __le16 mps; + __le16 scid[0]; +} __packed; + +#define L2CAP_RECONF_SUCCESS 0x0000 +#define L2CAP_RECONF_INVALID_MTU 0x0001 +#define L2CAP_RECONF_INVALID_MPS 0x0002 + +struct l2cap_ecred_reconf_rsp { + __le16 result; +} __packed; + /* ----- L2CAP channels and connections ----- */ struct l2cap_seq_list { __u16 head; @@ -726,6 +764,7 @@ enum { FLAG_EFS_ENABLE, FLAG_DEFER_SETUP, FLAG_LE_CONN_REQ_SENT, + FLAG_ECRED_CONN_REQ_SENT, FLAG_PENDING_SECURITY, FLAG_HOLD_HCI_CONN, };