linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] Bluetooth:LE credit based connection result values
@ 2018-10-04  5:29 Mallikarjun Phulari
  2018-10-04  5:29 ` [PATCH 2/2] Bluetooth : Errata Service Release 8, Erratum 3253 Mallikarjun Phulari
  2018-10-04 20:36 ` [PATCH 1/2] Bluetooth:LE credit based connection result values Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Mallikarjun Phulari @ 2018-10-04  5:29 UTC (permalink / raw)
  To: linux-bluetooth

Changes added to rename the l2cap connect/create result values.
Result values specific to LE Credit based connection are renamed
as L2CAP_CR_LE*, and changed the old names wherever they were used.

Signed-off-by: Mallikarjun Phulari <mallikarjun.phulari@intel.com>
---
 include/net/bluetooth/l2cap.h | 29 +++++++++++++++++------------
 net/bluetooth/l2cap_core.c    | 12 ++++++------
 2 files changed, 23 insertions(+), 18 deletions(-)

diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 0697fd4..35788d9 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -270,19 +270,24 @@ struct l2cap_conn_rsp {
 #define L2CAP_CID_DYN_END	0xffff
 #define L2CAP_CID_LE_DYN_END	0x007f
 
+/* Renaming the result values specific to
+ * LE Credit based connection as L2CAP_CR_LE_*,
+ * And changing the old result value wherever they were used
+ */
+
 /* connect/create channel results */
-#define L2CAP_CR_SUCCESS	0x0000
-#define L2CAP_CR_PEND		0x0001
-#define L2CAP_CR_BAD_PSM	0x0002
-#define L2CAP_CR_SEC_BLOCK	0x0003
-#define L2CAP_CR_NO_MEM		0x0004
-#define L2CAP_CR_BAD_AMP	0x0005
-#define L2CAP_CR_AUTHENTICATION	0x0005
-#define L2CAP_CR_AUTHORIZATION	0x0006
-#define L2CAP_CR_BAD_KEY_SIZE	0x0007
-#define L2CAP_CR_ENCRYPTION	0x0008
-#define L2CAP_CR_INVALID_SCID	0x0009
-#define L2CAP_CR_SCID_IN_USE	0x000A
+#define L2CAP_CR_SUCCESS		0x0000
+#define L2CAP_CR_PEND			0x0001
+#define L2CAP_CR_BAD_PSM		0x0002
+#define L2CAP_CR_SEC_BLOCK		0x0003
+#define L2CAP_CR_NO_MEM			0x0004
+#define L2CAP_CR_BAD_AMP		0x0005
+#define L2CAP_CR_LE_AUTHENTICATION	0x0005
+#define L2CAP_CR_LE_AUTHORIZATION	0x0006
+#define L2CAP_CR_LE_BAD_KEY_SIZE	0x0007
+#define L2CAP_CR_LE_ENCRYPTION		0x0008
+#define L2CAP_CR_LE_INVALID_SCID	0x0009
+#define L2CAP_CR_LE_SCID_IN_USE		0x000A
 
 /* connect/create channel status */
 #define L2CAP_CS_NO_INFO	0x0000
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index d17a473..1c49419 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -681,7 +681,7 @@ static void l2cap_chan_le_connect_reject(struct l2cap_chan *chan)
 	u16 result;
 
 	if (test_bit(FLAG_DEFER_SETUP, &chan->flags))
-		result = L2CAP_CR_AUTHORIZATION;
+		result = L2CAP_CR_LE_AUTHORIZATION;
 	else
 		result = L2CAP_CR_BAD_PSM;
 
@@ -5314,8 +5314,8 @@ static int l2cap_le_connect_rsp(struct l2cap_conn *conn,
 		l2cap_chan_ready(chan);
 		break;
 
-	case L2CAP_CR_AUTHENTICATION:
-	case L2CAP_CR_ENCRYPTION:
+	case L2CAP_CR_LE_AUTHENTICATION:
+	case L2CAP_CR_LE_ENCRYPTION:
 		/* If we already have MITM protection we can't do
 		 * anything.
 		 */
@@ -5468,21 +5468,21 @@ static int l2cap_le_connect_req(struct l2cap_conn *conn,
 
 	if (!smp_sufficient_security(conn->hcon, pchan->sec_level,
 				     SMP_ALLOW_STK)) {
-		result = L2CAP_CR_AUTHENTICATION;
+		result = L2CAP_CR_LE_AUTHENTICATION;
 		chan = NULL;
 		goto response_unlock;
 	}
 
 	/* Check for valid dynamic CID range */
 	if (scid < L2CAP_CID_DYN_START || scid > L2CAP_CID_LE_DYN_END) {
-		result = L2CAP_CR_INVALID_SCID;
+		result = L2CAP_CR_LE_INVALID_SCID;
 		chan = NULL;
 		goto response_unlock;
 	}
 
 	/* Check if we already have channel with that dcid */
 	if (__l2cap_get_chan_by_dcid(conn, scid)) {
-		result = L2CAP_CR_SCID_IN_USE;
+		result = L2CAP_CR_LE_SCID_IN_USE;
 		chan = NULL;
 		goto response_unlock;
 	}
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] Bluetooth : Errata Service Release 8, Erratum 3253
  2018-10-04  5:29 [PATCH 1/2] Bluetooth:LE credit based connection result values Mallikarjun Phulari
@ 2018-10-04  5:29 ` Mallikarjun Phulari
  2018-10-04 20:40   ` Marcel Holtmann
  2018-10-04 20:36 ` [PATCH 1/2] Bluetooth:LE credit based connection result values Marcel Holtmann
  1 sibling, 1 reply; 4+ messages in thread
From: Mallikarjun Phulari @ 2018-10-04  5:29 UTC (permalink / raw)
  To: linux-bluetooth

L2CAP: New result values
	0x0006 - Connection refused – Invalid Source CID
	0x0007 - Connection refused – Source CID already allocated

As per the ESR08_V1.0.0, 1.11.2 Erratum 3253, Page No. 54,
"Remote CID invalid Issue".
Applies to Core Specification versions: V5.0, V4.2, v4.1, v4.0, and v3.0 + HS
Vol 3, Part A, Section 4.2, 4.3, 4.14, 4.15.

Core Specification Version 5.0, Page No.1753, Table 4.6 and
Page No. 1767, Table 4.14

New result values are added to l2cap connect/create channel response as
0x0006 - Connection refused – Invalid Source CID
0x0007 - Connection refused – Source CID already allocated

Signed-off-by: Mallikarjun Phulari <mallikarjun.phulari@intel.com>
---
 include/net/bluetooth/l2cap.h |  6 ++++++
 net/bluetooth/l2cap_core.c    | 17 ++++++++++++++++-
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 35788d9..fd3998a 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -275,6 +275,10 @@ struct l2cap_conn_rsp {
  * And changing the old result value wherever they were used
  */
 
+/* Adding two new connect/create channel results
+ * As per ESR08_V1.0.0, Erratum 3253
+ */
+
 /* connect/create channel results */
 #define L2CAP_CR_SUCCESS		0x0000
 #define L2CAP_CR_PEND			0x0001
@@ -282,6 +286,8 @@ struct l2cap_conn_rsp {
 #define L2CAP_CR_SEC_BLOCK		0x0003
 #define L2CAP_CR_NO_MEM			0x0004
 #define L2CAP_CR_BAD_AMP		0x0005
+#define L2CAP_CR_INVALID_SCID		0x0006
+#define L2CAP_CR_SCID_IN_USE		0x0007
 #define L2CAP_CR_LE_AUTHENTICATION	0x0005
 #define L2CAP_CR_LE_AUTHORIZATION	0x0006
 #define L2CAP_CR_LE_BAD_KEY_SIZE	0x0007
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 1c49419..85179ac 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3815,9 +3815,24 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn,
 
 	result = L2CAP_CR_NO_MEM;
 
+	/* As per ESR08_V1.0.0, Erratum 3253, check the CID is in valid
+	 * dynamic range and is not allocated already.
+	 * Send the new result values accordingly
+	 */
+
+	/* Check for valid dynamic CID range */
+	if (scid < L2CAP_CID_DYN_START || scid > L2CAP_CID_DYN_END) {
+		result = L2CAP_CR_INVALID_SCID;
+		chan = NULL;
+		goto response;
+	}
+
 	/* Check if we already have channel with that dcid */
-	if (__l2cap_get_chan_by_dcid(conn, scid))
+	if (__l2cap_get_chan_by_dcid(conn, scid)) {
+		result = L2CAP_CR_SCID_IN_USE;
+		chan = NULL;
 		goto response;
+	}
 
 	chan = pchan->ops->new_connection(pchan);
 	if (!chan)
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] Bluetooth:LE credit based connection result values
  2018-10-04  5:29 [PATCH 1/2] Bluetooth:LE credit based connection result values Mallikarjun Phulari
  2018-10-04  5:29 ` [PATCH 2/2] Bluetooth : Errata Service Release 8, Erratum 3253 Mallikarjun Phulari
@ 2018-10-04 20:36 ` Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2018-10-04 20:36 UTC (permalink / raw)
  To: Mallikarjun Phulari; +Cc: linux-bluetooth

Hi Mallikarjun,

> Changes added to rename the l2cap connect/create result values.
> Result values specific to LE Credit based connection are renamed
> as L2CAP_CR_LE*, and changed the old names wherever they were used.
> 
> Signed-off-by: Mallikarjun Phulari <mallikarjun.phulari@intel.com>
> ---
> include/net/bluetooth/l2cap.h | 29 +++++++++++++++++------------
> net/bluetooth/l2cap_core.c    | 12 ++++++------
> 2 files changed, 23 insertions(+), 18 deletions(-)
> 
> diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
> index 0697fd4..35788d9 100644
> --- a/include/net/bluetooth/l2cap.h
> +++ b/include/net/bluetooth/l2cap.h
> @@ -270,19 +270,24 @@ struct l2cap_conn_rsp {
> #define L2CAP_CID_DYN_END	0xffff
> #define L2CAP_CID_LE_DYN_END	0x007f
> 
> +/* Renaming the result values specific to
> + * LE Credit based connection as L2CAP_CR_LE_*,
> + * And changing the old result value wherever they were used
> + */

why is this a comment?

> +
> /* connect/create channel results */
> -#define L2CAP_CR_SUCCESS	0x0000
> -#define L2CAP_CR_PEND		0x0001
> -#define L2CAP_CR_BAD_PSM	0x0002
> -#define L2CAP_CR_SEC_BLOCK	0x0003
> -#define L2CAP_CR_NO_MEM		0x0004
> -#define L2CAP_CR_BAD_AMP	0x0005
> -#define L2CAP_CR_AUTHENTICATION	0x0005
> -#define L2CAP_CR_AUTHORIZATION	0x0006
> -#define L2CAP_CR_BAD_KEY_SIZE	0x0007
> -#define L2CAP_CR_ENCRYPTION	0x0008
> -#define L2CAP_CR_INVALID_SCID	0x0009
> -#define L2CAP_CR_SCID_IN_USE	0x000A
> +#define L2CAP_CR_SUCCESS		0x0000
> +#define L2CAP_CR_PEND			0x0001
> +#define L2CAP_CR_BAD_PSM		0x0002
> +#define L2CAP_CR_SEC_BLOCK		0x0003
> +#define L2CAP_CR_NO_MEM			0x0004
> +#define L2CAP_CR_BAD_AMP		0x0005

Keep the original BR/EDR in a separate block. So an empty line here and no need to realign them.

Then create this a block and add comment /* credit based connect results */

And it needs the following:

L2CAP_CR_LE_SUCCESS	0x0000
L2CAP_CR_LE_BAD_PSM	0x0001
L2CAP_CR_LE_NO_MEM	0x0004

And they need to be used for the LE side instead of the BR/EDR ones.

> +#define L2CAP_CR_LE_AUTHENTICATION	0x0005
> +#define L2CAP_CR_LE_AUTHORIZATION	0x0006
> +#define L2CAP_CR_LE_BAD_KEY_SIZE	0x0007
> +#define L2CAP_CR_LE_ENCRYPTION		0x0008
> +#define L2CAP_CR_LE_INVALID_SCID	0x0009
> +#define L2CAP_CR_LE_SCID_IN_USE		0x000A

Regards

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] Bluetooth : Errata Service Release 8, Erratum 3253
  2018-10-04  5:29 ` [PATCH 2/2] Bluetooth : Errata Service Release 8, Erratum 3253 Mallikarjun Phulari
@ 2018-10-04 20:40   ` Marcel Holtmann
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2018-10-04 20:40 UTC (permalink / raw)
  To: Mallikarjun Phulari; +Cc: linux-bluetooth

Hi Mallikarjun,

> L2CAP: New result values
> 	0x0006 - Connection refused – Invalid Source CID
> 	0x0007 - Connection refused – Source CID already allocated
> 
> As per the ESR08_V1.0.0, 1.11.2 Erratum 3253, Page No. 54,
> "Remote CID invalid Issue".
> Applies to Core Specification versions: V5.0, V4.2, v4.1, v4.0, and v3.0 + HS
> Vol 3, Part A, Section 4.2, 4.3, 4.14, 4.15.
> 
> Core Specification Version 5.0, Page No.1753, Table 4.6 and
> Page No. 1767, Table 4.14
> 
> New result values are added to l2cap connect/create channel response as
> 0x0006 - Connection refused – Invalid Source CID
> 0x0007 - Connection refused – Source CID already allocated
> 
> Signed-off-by: Mallikarjun Phulari <mallikarjun.phulari@intel.com>
> ---
> include/net/bluetooth/l2cap.h |  6 ++++++
> net/bluetooth/l2cap_core.c    | 17 ++++++++++++++++-
> 2 files changed, 22 insertions(+), 1 deletion(-)
> 
> diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
> index 35788d9..fd3998a 100644
> --- a/include/net/bluetooth/l2cap.h
> +++ b/include/net/bluetooth/l2cap.h
> @@ -275,6 +275,10 @@ struct l2cap_conn_rsp {
>  * And changing the old result value wherever they were used
>  */
> 
> +/* Adding two new connect/create channel results
> + * As per ESR08_V1.0.0, Erratum 3253
> + */
> +

what is this doing in the code? This is for the commit message.

> /* connect/create channel results */
> #define L2CAP_CR_SUCCESS		0x0000
> #define L2CAP_CR_PEND			0x0001
> @@ -282,6 +286,8 @@ struct l2cap_conn_rsp {
> #define L2CAP_CR_SEC_BLOCK		0x0003
> #define L2CAP_CR_NO_MEM			0x0004
> #define L2CAP_CR_BAD_AMP		0x0005
> +#define L2CAP_CR_INVALID_SCID		0x0006
> +#define L2CAP_CR_SCID_IN_USE		0x0007
> #define L2CAP_CR_LE_AUTHENTICATION	0x0005
> #define L2CAP_CR_LE_AUTHORIZATION	0x0006
> #define L2CAP_CR_LE_BAD_KEY_SIZE	0x0007
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index 1c49419..85179ac 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -3815,9 +3815,24 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn,
> 
> 	result = L2CAP_CR_NO_MEM;
> 
> +	/* As per ESR08_V1.0.0, Erratum 3253, check the CID is in valid
> +	 * dynamic range and is not allocated already.
> +	 * Send the new result values accordingly
> +	 */
> +
> +	/* Check for valid dynamic CID range */

	/* Check for valid dynamic CID range (as per Erratum 3253) */

And then scrap the other comments above.

> +	if (scid < L2CAP_CID_DYN_START || scid > L2CAP_CID_DYN_END) {
> +		result = L2CAP_CR_INVALID_SCID;
> +		chan = NULL;
> +		goto response;
> +	}
> +
> 	/* Check if we already have channel with that dcid */
> -	if (__l2cap_get_chan_by_dcid(conn, scid))
> +	if (__l2cap_get_chan_by_dcid(conn, scid)) {
> +		result = L2CAP_CR_SCID_IN_USE;
> +		chan = NULL;

I do not get this chan = NULL setting here (and above as well). I was not needed before, why is it needed now?

> 		goto response;
> +	}
> 
> 	chan = pchan->ops->new_connection(pchan);
> 	if (!chan)

Regards

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-10-04 20:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-04  5:29 [PATCH 1/2] Bluetooth:LE credit based connection result values Mallikarjun Phulari
2018-10-04  5:29 ` [PATCH 2/2] Bluetooth : Errata Service Release 8, Erratum 3253 Mallikarjun Phulari
2018-10-04 20:40   ` Marcel Holtmann
2018-10-04 20:36 ` [PATCH 1/2] Bluetooth:LE credit based connection result values Marcel Holtmann

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).