linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] android/gatt: Fix not setting error properly for exec write
@ 2014-12-10 12:40 Jakub Tyszkowski
  2014-12-10 12:40 ` [PATCH 2/3] android/gatt: Fix passing out of att range errors Jakub Tyszkowski
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Jakub Tyszkowski @ 2014-12-10 12:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

We were not properly propagating errors returned by applications.
---
 android/gatt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/android/gatt.c b/android/gatt.c
index e24feb7..18a5092 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5544,6 +5544,7 @@ static void handle_server_send_response(const void *buf, uint16_t len)
 		 * gatt_db_attribute_write().
 		 */
 		req = queue_peek_head(conn->device->pending_requests);
+		req->error = err_to_att(cmd->status);
 		req->state = REQUEST_DONE;
 
 		/*
-- 
1.9.1


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

* [PATCH 2/3] android/gatt: Fix passing out of att range errors
  2014-12-10 12:40 [PATCH 1/3] android/gatt: Fix not setting error properly for exec write Jakub Tyszkowski
@ 2014-12-10 12:40 ` Jakub Tyszkowski
  2014-12-10 12:40 ` [PATCH 3/3] android/pts: Update gatt serwer results Jakub Tyszkowski
  2014-12-10 13:19 ` [PATCH 1/3] android/gatt: Fix not setting error properly for exec write Szymon Janc
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Tyszkowski @ 2014-12-10 12:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

Those statuses or errors are of type int and and we need to crop
them to att's range. This fixes potential issues when user app sends
status that is equal or greater than GATT_FAILURE.
---
 android/gatt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 18a5092..b2ce9c1 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -5556,12 +5556,12 @@ static void handle_server_send_response(const void *buf, uint16_t len)
 	if (transaction->opcode < ATT_OP_WRITE_REQ)
 		gatt_db_attribute_read_result(transaction->attrib,
 						transaction->serial_id,
-						cmd->status,
+						err_to_att(cmd->status),
 						cmd->data, cmd->len);
 	else
 		gatt_db_attribute_write_result(transaction->attrib,
 						transaction->serial_id,
-						cmd->status);
+						err_to_att(cmd->status));
 
 	send_dev_complete_response(conn->device, transaction->opcode);
 
-- 
1.9.1


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

* [PATCH 3/3] android/pts: Update gatt serwer results
  2014-12-10 12:40 [PATCH 1/3] android/gatt: Fix not setting error properly for exec write Jakub Tyszkowski
  2014-12-10 12:40 ` [PATCH 2/3] android/gatt: Fix passing out of att range errors Jakub Tyszkowski
@ 2014-12-10 12:40 ` Jakub Tyszkowski
  2014-12-10 13:19 ` [PATCH 1/3] android/gatt: Fix not setting error properly for exec write Szymon Janc
  2 siblings, 0 replies; 4+ messages in thread
From: Jakub Tyszkowski @ 2014-12-10 12:40 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Jakub Tyszkowski

---
 android/pts-gatt.txt | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/android/pts-gatt.txt b/android/pts-gatt.txt
index 43e1c8a..d1cf981 100644
--- a/android/pts-gatt.txt
+++ b/android/pts-gatt.txt
@@ -783,7 +783,7 @@ TC_GAW_SR_BI_06_C	PASS	haltest:
 						<properties> 10 <permissions> 17
 				gatts start_service
 				gatts send_response: <status> 12
-TC_GAW_SR_BV_05_C	FAIL	haltest:
+TC_GAW_SR_BV_05_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 10 <permissions> 17
@@ -793,18 +793,18 @@ TC_GAW_SR_BV_05_C	FAIL	haltest:
 						repeat with correct offset
 				gatts send_response:
 						repeat with correct value
-TC_GAW_SR_BI_07_C	FAIL	haltest:
+TC_GAW_SR_BI_07_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 10 <permissions> 17
 				gatts start_service
 				gatts send_response
-TC_GAW_SR_BI_08_C	FAIL	haltest:
+TC_GAW_SR_BI_08_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 2 <permissions> 1
 				gatts start_service
-TC_GAW_SR_BI_09_C	FAIL	haltest:
+TC_GAW_SR_BI_09_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 10 <permissions> 17
@@ -813,7 +813,7 @@ TC_GAW_SR_BI_09_C	FAIL	haltest:
 						<data> value greater than MTU
 						repeat with correct offset
 				gatts send_response: <status> 7
-TC_GAW_SR_BI_11_C	FAIL	haltest:
+TC_GAW_SR_BI_11_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 10 <permissions> 17
@@ -822,7 +822,7 @@ TC_GAW_SR_BI_11_C	FAIL	haltest:
 						<data> value greater than MTU
 						repeat with correct offset
 				gatts send_response: <status> 8
-TC_GAW_SR_BI_12_C	FAIL	haltest:
+TC_GAW_SR_BI_12_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 10 <permissions> 17
@@ -831,7 +831,7 @@ TC_GAW_SR_BI_12_C	FAIL	haltest:
 						<data> value greater than MTU
 						repeat with correct offset
 				gatts send_response: <status> 5
-TC_GAW_SR_BI_13_C	FAIL	haltest:
+TC_GAW_SR_BI_13_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 10 <permissions> 17
@@ -840,14 +840,14 @@ TC_GAW_SR_BI_13_C	FAIL	haltest:
 						<data> value greater than MTU
 						repeat with correct offset
 				gatts send_response: <status> 12
-TC_GAW_SR_BV_06_C	FAIL	haltest:
+TC_GAW_SR_BV_06_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 10 <permissions> 17
 				gatts start_service
 				gatts send_response:
 						repeat with correct value
-TC_GAW_SR_BV_10_C	FAIL	haltest:
+TC_GAW_SR_BV_10_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 10 <permissions> 17
@@ -857,37 +857,37 @@ TC_GAW_SR_BV_10_C	FAIL	haltest:
 						repeat with correct offset
 				gatts send_response:
 						repeat with correct value
-TC_GAW_SR_BI_14_C	FAIL	haltest:
+TC_GAW_SR_BI_14_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 10 <permissions> 17
 				gatts start_service
 				gatts send_response: <status> 1
-TC_GAW_SR_BI_15_C	FAIL	haltest:
+TC_GAW_SR_BI_15_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 10 <permissions> 17
 				gatts start_service
 				gatts send_response: <status> 3
-TC_GAW_SR_BI_17_C	FAIL	haltest:
+TC_GAW_SR_BI_17_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 10 <permissions> 17
 				gatts start_service
 				gatts send_response: <status> 8
-TC_GAW_SR_BI_18_C	FAIL	haltest:
+TC_GAW_SR_BI_18_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 10 <permissions> 17
 				gatts start_service
 				gatts send_response: <status> 5
-TC_GAW_SR_BI_19_C	FAIL	haltest:
+TC_GAW_SR_BI_19_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 10 <permissions> 17
 				gatts start_service
 				gatts send_response: <status> 12
-TC_GAW_SR_BV_07_C	FAIL	haltest:
+TC_GAW_SR_BV_07_C	PASS	haltest:
 				gatts add_service
 				gatts add_characteristic:
 						<properties> 10 <permissions> 17
-- 
1.9.1


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

* Re: [PATCH 1/3] android/gatt: Fix not setting error properly for exec write
  2014-12-10 12:40 [PATCH 1/3] android/gatt: Fix not setting error properly for exec write Jakub Tyszkowski
  2014-12-10 12:40 ` [PATCH 2/3] android/gatt: Fix passing out of att range errors Jakub Tyszkowski
  2014-12-10 12:40 ` [PATCH 3/3] android/pts: Update gatt serwer results Jakub Tyszkowski
@ 2014-12-10 13:19 ` Szymon Janc
  2 siblings, 0 replies; 4+ messages in thread
From: Szymon Janc @ 2014-12-10 13:19 UTC (permalink / raw)
  To: Jakub Tyszkowski; +Cc: linux-bluetooth

Hi Jakub,

On Wednesday 10 of December 2014 13:40:49 Jakub Tyszkowski wrote:
> We were not properly propagating errors returned by applications.
> ---
>  android/gatt.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/android/gatt.c b/android/gatt.c
> index e24feb7..18a5092 100644
> --- a/android/gatt.c
> +++ b/android/gatt.c
> @@ -5544,6 +5544,7 @@ static void handle_server_send_response(const void
> *buf, uint16_t len) * gatt_db_attribute_write().
>  		 */
>  		req = queue_peek_head(conn->device->pending_requests);
> +		req->error = err_to_att(cmd->status);
>  		req->state = REQUEST_DONE;
> 
>  		/*

All patches applied (after fixing typo in last commit message), thanks.

-- 
BR
Szymon Janc

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

end of thread, other threads:[~2014-12-10 13:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-10 12:40 [PATCH 1/3] android/gatt: Fix not setting error properly for exec write Jakub Tyszkowski
2014-12-10 12:40 ` [PATCH 2/3] android/gatt: Fix passing out of att range errors Jakub Tyszkowski
2014-12-10 12:40 ` [PATCH 3/3] android/pts: Update gatt serwer results Jakub Tyszkowski
2014-12-10 13:19 ` [PATCH 1/3] android/gatt: Fix not setting error properly for exec write Szymon Janc

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