All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] Bluetooth: Fix response on confirm_name
@ 2014-02-27 15:12 Lukasz Rymanowski
  2014-02-27 15:47 ` Marcel Holtmann
  0 siblings, 1 reply; 3+ messages in thread
From: Lukasz Rymanowski @ 2014-02-27 15:12 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Lukasz Rymanowski

According to mgmt-api.txt, in case of confirm name command,
cmd_complete should be always use as a response. Not command status
as it is now for failures.
Using command complete on failure is actually better as client might
be interested in device address for which confirm name failed.

Signed-off-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
---
 net/bluetooth/mgmt.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 4c4912e..8b7a3c4 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3627,15 +3627,17 @@ static int confirm_name(struct sock *sk, struct hci_dev *hdev, void *data,
 	hci_dev_lock(hdev);
 
 	if (!hci_discovery_active(hdev)) {
-		err = cmd_status(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
-				 MGMT_STATUS_FAILED);
+		err = cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
+						MGMT_STATUS_FAILED, &cp->addr,
+							sizeof(cp->addr));
 		goto failed;
 	}
 
 	e = hci_inquiry_cache_lookup_unknown(hdev, &cp->addr.bdaddr);
 	if (!e) {
-		err = cmd_status(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
-				 MGMT_STATUS_INVALID_PARAMS);
+		err = cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
+					MGMT_STATUS_INVALID_PARAMS, &cp->addr,
+							sizeof(cp->addr));
 		goto failed;
 	}
 
-- 
1.8.4


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

* Re: [PATCH v2] Bluetooth: Fix response on confirm_name
  2014-02-27 15:12 [PATCH v2] Bluetooth: Fix response on confirm_name Lukasz Rymanowski
@ 2014-02-27 15:47 ` Marcel Holtmann
  2014-02-27 15:52   ` Lukasz Rymanowski
  0 siblings, 1 reply; 3+ messages in thread
From: Marcel Holtmann @ 2014-02-27 15:47 UTC (permalink / raw)
  To: Lukasz Rymanowski; +Cc: linux-bluetooth

Hi Lukasz,

> According to mgmt-api.txt, in case of confirm name command,
> cmd_complete should be always use as a response. Not command status
> as it is now for failures.
> Using command complete on failure is actually better as client might
> be interested in device address for which confirm name failed.
> 
> Signed-off-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
> ---
> net/bluetooth/mgmt.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 4c4912e..8b7a3c4 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -3627,15 +3627,17 @@ static int confirm_name(struct sock *sk, struct hci_dev *hdev, void *data,
> 	hci_dev_lock(hdev);
> 
> 	if (!hci_discovery_active(hdev)) {
> -		err = cmd_status(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
> -				 MGMT_STATUS_FAILED);
> +		err = cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
> +						MGMT_STATUS_FAILED, &cp->addr,
> +							sizeof(cp->addr));

you are testing me, right ;)

Regards

Marcel


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

* Re: [PATCH v2] Bluetooth: Fix response on confirm_name
  2014-02-27 15:47 ` Marcel Holtmann
@ 2014-02-27 15:52   ` Lukasz Rymanowski
  0 siblings, 0 replies; 3+ messages in thread
From: Lukasz Rymanowski @ 2014-02-27 15:52 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On 27 February 2014 16:47, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Lukasz,
>
>> According to mgmt-api.txt, in case of confirm name command,
>> cmd_complete should be always use as a response. Not command status
>> as it is now for failures.
>> Using command complete on failure is actually better as client might
>> be interested in device address for which confirm name failed.
>>
>> Signed-off-by: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
>> ---
>> net/bluetooth/mgmt.c | 10 ++++++----
>> 1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
>> index 4c4912e..8b7a3c4 100644
>> --- a/net/bluetooth/mgmt.c
>> +++ b/net/bluetooth/mgmt.c
>> @@ -3627,15 +3627,17 @@ static int confirm_name(struct sock *sk, struct hci_dev *hdev, void *data,
>>       hci_dev_lock(hdev);
>>
>>       if (!hci_discovery_active(hdev)) {
>> -             err = cmd_status(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
>> -                              MGMT_STATUS_FAILED);
>> +             err = cmd_complete(sk, hdev->id, MGMT_OP_CONFIRM_NAME,
>> +                                             MGMT_STATUS_FAILED, &cp->addr,
>> +                                                     sizeof(cp->addr));
>
> you are testing me, right ;)
>

Yup, and you are doing just fine :)
btw, v3 is the one.

> Regards
>
> Marcel
>

BR
\Lukasz

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

end of thread, other threads:[~2014-02-27 15:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-27 15:12 [PATCH v2] Bluetooth: Fix response on confirm_name Lukasz Rymanowski
2014-02-27 15:47 ` Marcel Holtmann
2014-02-27 15:52   ` Lukasz Rymanowski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.