From: Mallikarjun Phulari <mallikarjun.phulari@intel.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] Bluetooth : Errata Service Release 8 Erratum 3253
Date: Wed, 19 Sep 2018 15:21:54 +0530 [thread overview]
Message-ID: <1537350714-32105-1-git-send-email-mallikarjun.phulari@intel.com> (raw)
L2CAP: Changes include the new result codes for the l2cap channel
create/connect request. The new result code are:
0x0006 - sent in the response when the CID is not in valid dynamic range.
0x0007 sent in the response when the CID is already allocated.
---
include/net/bluetooth/l2cap.h | 6 ++++++
net/bluetooth/l2cap_core.c | 12 ++++++++++++
2 files changed, 18 insertions(+)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 0697fd4..eb0c8d0 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -284,6 +284,12 @@ struct l2cap_conn_rsp {
#define L2CAP_CR_INVALID_SCID 0x0009
#define L2CAP_CR_SCID_IN_USE 0x000A
+/* connect/create channel results
+ * As per Erratum 3253
+ */
+#define L2CAP_CR_BREDR_INVALID_SCID 0x0006
+#define L2CAP_CR_BREDR_SCID_IN_USE 0x0007
+
/* connect/create channel status */
#define L2CAP_CS_NO_INFO 0x0000
#define L2CAP_CS_AUTHEN_PEND 0x0001
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 9b7907e..85887df 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3814,9 +3814,21 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn,
}
result = L2CAP_CR_NO_MEM;
+ /* As per Erratum 3253, check the CID is in valid dynamic range and
+ * is not allocated already. Send the new result codes accordingly
+ */
+
+ /* Check for valid dynamic CID range */
+ if (scid < L2CAP_CID_DYN_START || scid > L2CAP_CID_DYN_END) {
+ result = L2CAP_CR_BREDR_INVALID_SCID;
+ chan = NULL;
+ goto response;
+ }
/* Check if we already have channel with that dcid */
if (__l2cap_get_chan_by_dcid(conn, scid))
+ result = L2CAP_CR_BREDR_SCID_IN_USE;
+ chan = NULL;
goto response;
chan = pchan->ops->new_connection(pchan);
--
2.7.4
next reply other threads:[~2018-09-19 9:51 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-19 9:51 Mallikarjun Phulari [this message]
2018-09-19 12:06 ` [PATCH] Bluetooth : Errata Service Release 8 Erratum 3253 Luiz Augusto von Dentz
2018-09-21 4:37 ` Phulari, Mallikarjun
2018-09-21 11:44 ` Luiz Augusto von Dentz
2018-09-24 9:16 [PATCH] Bluetooth : Errata Service Release 8, " Mallikarjun Phulari
2018-09-27 10:37 ` Marcel Holtmann
2018-10-01 9:26 ` Phulari, Mallikarjun
2018-10-03 6:56 ` Marcel Holtmann
2018-10-03 11:59 ` Phulari, Mallikarjun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1537350714-32105-1-git-send-email-mallikarjun.phulari@intel.com \
--to=mallikarjun.phulari@intel.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).