linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ v3 0/1] Fix remove temporary link key for No Bonding
@ 2011-08-22 13:45 Dmitriy Paliy
  2011-08-22 13:45 ` [PATCH BlueZ v3] " Dmitriy Paliy
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitriy Paliy @ 2011-08-22 13:45 UTC (permalink / raw)
  To: linux-bluetooth

Hi,

This patch takes into account comment of Luiz about moving
btd_adapter_remove_bonding in device_set_paired(device, FALSE).

Br,
Dmitriy


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

* [PATCH BlueZ v3] Fix remove temporary link key for No Bonding
  2011-08-22 13:45 [PATCH BlueZ v3 0/1] Fix remove temporary link key for No Bonding Dmitriy Paliy
@ 2011-08-22 13:45 ` Dmitriy Paliy
  2011-08-22 14:02   ` Luiz Augusto von Dentz
  2011-08-23 11:59   ` Johan Hedberg
  0 siblings, 2 replies; 6+ messages in thread
From: Dmitriy Paliy @ 2011-08-22 13:45 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Dmitriy Paliy

This fixes regression caused by 33cdfcb0fabcfb5260953a13ae277b5abe9a322d.
Temporary link key should be removed after device is disconnected if
bonding information is not stored in file system.

Currently, the key is deleted only when paired device is removed, or
adapter is powered off. In case of No Bonding authentication, device is
not paired after disconnection, which results in link key left in memory.

On the other hand, device is not necessarily removed after disconnection
that also leaves unneeded temporary link key in memory. Therefore,
btd_adapter_remove_bonding is moved to device_set_paired(device, FALSE)
covering both cases.
---
 src/device.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/device.c b/src/device.c
index 9dd657c..96e798f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -993,7 +993,6 @@ static void device_remove_stored(struct btd_device *device)
 		delete_entry(&src, "aliases", addr);
 		device_set_bonded(device, FALSE);
 		device_set_paired(device, FALSE);
-		btd_adapter_remove_bonding(device->adapter, &device->bdaddr);
 	}
 	delete_entry(&src, "profiles", addr);
 	delete_entry(&src, "trusts", addr);
@@ -2038,6 +2037,9 @@ void device_set_paired(struct btd_device *device, gboolean value)
 	if (device->paired == value)
 		return;
 
+	if (!value)
+		btd_adapter_remove_bonding(device->adapter, &device->bdaddr);
+
 	device->paired = value;
 
 	emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Paired",
-- 
1.7.4.1


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

* Re: [PATCH BlueZ v3] Fix remove temporary link key for No Bonding
  2011-08-22 13:45 ` [PATCH BlueZ v3] " Dmitriy Paliy
@ 2011-08-22 14:02   ` Luiz Augusto von Dentz
  2011-08-22 14:06     ` Dmitriy Paliy
  2011-08-23 11:59   ` Johan Hedberg
  1 sibling, 1 reply; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2011-08-22 14:02 UTC (permalink / raw)
  To: Dmitriy Paliy; +Cc: linux-bluetooth

Hi Dmitriy,

On Mon, Aug 22, 2011 at 4:45 PM, Dmitriy Paliy <dmitriy.paliy@nokia.com> wrote:
> This fixes regression caused by 33cdfcb0fabcfb5260953a13ae277b5abe9a322d.
> Temporary link key should be removed after device is disconnected if
> bonding information is not stored in file system.
>
> Currently, the key is deleted only when paired device is removed, or
> adapter is powered off. In case of No Bonding authentication, device is
> not paired after disconnection, which results in link key left in memory.
>
> On the other hand, device is not necessarily removed after disconnection
> that also leaves unneeded temporary link key in memory. Therefore,
> btd_adapter_remove_bonding is moved to device_set_paired(device, FALSE)
> covering both cases.
> ---
>  src/device.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/src/device.c b/src/device.c
> index 9dd657c..96e798f 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -993,7 +993,6 @@ static void device_remove_stored(struct btd_device *device)
>                delete_entry(&src, "aliases", addr);
>                device_set_bonded(device, FALSE);
>                device_set_paired(device, FALSE);
> -               btd_adapter_remove_bonding(device->adapter, &device->bdaddr);
>        }
>        delete_entry(&src, "profiles", addr);
>        delete_entry(&src, "trusts", addr);
> @@ -2038,6 +2037,9 @@ void device_set_paired(struct btd_device *device, gboolean value)
>        if (device->paired == value)
>                return;
>
> +       if (!value)
> +               btd_adapter_remove_bonding(device->adapter, &device->bdaddr);
> +
>        device->paired = value;
>
>        emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Paired",
> --
> 1.7.4.1

There is one more place where we use btd_adapter_remove_bonding see
device_remove_stored.

-- 
Luiz Augusto von Dentz

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

* Re: [PATCH BlueZ v3] Fix remove temporary link key for No Bonding
  2011-08-22 14:02   ` Luiz Augusto von Dentz
@ 2011-08-22 14:06     ` Dmitriy Paliy
  2011-08-22 18:12       ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 6+ messages in thread
From: Dmitriy Paliy @ 2011-08-22 14:06 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: Dmitriy Paliy, linux-bluetooth

Hi Luiz,

On Mon, Aug 22, 2011 at 5:02 PM, Luiz Augusto von Dentz
<luiz.dentz@gmail.com> wrote:
> Hi Dmitriy,
>
> On Mon, Aug 22, 2011 at 4:45 PM, Dmitriy Paliy <dmitriy.paliy@nokia.com> wrote:
>> This fixes regression caused by 33cdfcb0fabcfb5260953a13ae277b5abe9a322d.
>> Temporary link key should be removed after device is disconnected if
>> bonding information is not stored in file system.
>>
>> Currently, the key is deleted only when paired device is removed, or
>> adapter is powered off. In case of No Bonding authentication, device is
>> not paired after disconnection, which results in link key left in memory.
>>
>> On the other hand, device is not necessarily removed after disconnection
>> that also leaves unneeded temporary link key in memory. Therefore,
>> btd_adapter_remove_bonding is moved to device_set_paired(device, FALSE)
>> covering both cases.
>> ---
>>  src/device.c |    4 +++-
>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>
>> diff --git a/src/device.c b/src/device.c
>> index 9dd657c..96e798f 100644
>> --- a/src/device.c
>> +++ b/src/device.c
>> @@ -993,7 +993,6 @@ static void device_remove_stored(struct btd_device *device)
>>                delete_entry(&src, "aliases", addr);
>>                device_set_bonded(device, FALSE);
>>                device_set_paired(device, FALSE);
>> -               btd_adapter_remove_bonding(device->adapter, &device->bdaddr);
>>        }
>>        delete_entry(&src, "profiles", addr);
>>        delete_entry(&src, "trusts", addr);
>> @@ -2038,6 +2037,9 @@ void device_set_paired(struct btd_device *device, gboolean value)
>>        if (device->paired == value)
>>                return;
>>
>> +       if (!value)
>> +               btd_adapter_remove_bonding(device->adapter, &device->bdaddr);
>> +
>>        device->paired = value;
>>
>>        emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Paired",
>> --
>> 1.7.4.1
>
> There is one more place where we use btd_adapter_remove_bonding see
> device_remove_stored.

Yes, I removed it from there, since it is in device_set_paired. Could
you elaborate more?

Dmitriy

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

* Re: [PATCH BlueZ v3] Fix remove temporary link key for No Bonding
  2011-08-22 14:06     ` Dmitriy Paliy
@ 2011-08-22 18:12       ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2011-08-22 18:12 UTC (permalink / raw)
  To: Dmitriy Paliy; +Cc: Dmitriy Paliy, linux-bluetooth

Hi Dmitriy,

On Mon, Aug 22, 2011 at 5:06 PM, Dmitriy Paliy <dmitriy.paliy@gmail.com> wrote:
> Hi Luiz,
>
> On Mon, Aug 22, 2011 at 5:02 PM, Luiz Augusto von Dentz
> <luiz.dentz@gmail.com> wrote:
>> Hi Dmitriy,
>>
>> On Mon, Aug 22, 2011 at 4:45 PM, Dmitriy Paliy <dmitriy.paliy@nokia.com> wrote:
>>> This fixes regression caused by 33cdfcb0fabcfb5260953a13ae277b5abe9a322d.
>>> Temporary link key should be removed after device is disconnected if
>>> bonding information is not stored in file system.
>>>
>>> Currently, the key is deleted only when paired device is removed, or
>>> adapter is powered off. In case of No Bonding authentication, device is
>>> not paired after disconnection, which results in link key left in memory.
>>>
>>> On the other hand, device is not necessarily removed after disconnection
>>> that also leaves unneeded temporary link key in memory. Therefore,
>>> btd_adapter_remove_bonding is moved to device_set_paired(device, FALSE)
>>> covering both cases.
>>> ---
>>>  src/device.c |    4 +++-
>>>  1 files changed, 3 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/src/device.c b/src/device.c
>>> index 9dd657c..96e798f 100644
>>> --- a/src/device.c
>>> +++ b/src/device.c
>>> @@ -993,7 +993,6 @@ static void device_remove_stored(struct btd_device *device)
>>>                delete_entry(&src, "aliases", addr);
>>>                device_set_bonded(device, FALSE);
>>>                device_set_paired(device, FALSE);
>>> -               btd_adapter_remove_bonding(device->adapter, &device->bdaddr);
>>>        }
>>>        delete_entry(&src, "profiles", addr);
>>>        delete_entry(&src, "trusts", addr);
>>> @@ -2038,6 +2037,9 @@ void device_set_paired(struct btd_device *device, gboolean value)
>>>        if (device->paired == value)
>>>                return;
>>>
>>> +       if (!value)
>>> +               btd_adapter_remove_bonding(device->adapter, &device->bdaddr);
>>> +
>>>        device->paired = value;
>>>
>>>        emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Paired",
>>> --
>>> 1.7.4.1
>>
>> There is one more place where we use btd_adapter_remove_bonding see
>> device_remove_stored.
>
> Yes, I removed it from there, since it is in device_set_paired. Could
> you elaborate more?

My bad, didn't see you have changed that.

-- 
Luiz Augusto von Dentz

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

* Re: [PATCH BlueZ v3] Fix remove temporary link key for No Bonding
  2011-08-22 13:45 ` [PATCH BlueZ v3] " Dmitriy Paliy
  2011-08-22 14:02   ` Luiz Augusto von Dentz
@ 2011-08-23 11:59   ` Johan Hedberg
  1 sibling, 0 replies; 6+ messages in thread
From: Johan Hedberg @ 2011-08-23 11:59 UTC (permalink / raw)
  To: Dmitriy Paliy; +Cc: linux-bluetooth

Hi Dmitriy,

On Mon, Aug 22, 2011, Dmitriy Paliy wrote:
> This fixes regression caused by 33cdfcb0fabcfb5260953a13ae277b5abe9a322d.
> Temporary link key should be removed after device is disconnected if
> bonding information is not stored in file system.
> 
> Currently, the key is deleted only when paired device is removed, or
> adapter is powered off. In case of No Bonding authentication, device is
> not paired after disconnection, which results in link key left in memory.
> 
> On the other hand, device is not necessarily removed after disconnection
> that also leaves unneeded temporary link key in memory. Therefore,
> btd_adapter_remove_bonding is moved to device_set_paired(device, FALSE)
> covering both cases.
> ---
>  src/device.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)

Applied. Thanks.

Johan

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

end of thread, other threads:[~2011-08-23 11:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-22 13:45 [PATCH BlueZ v3 0/1] Fix remove temporary link key for No Bonding Dmitriy Paliy
2011-08-22 13:45 ` [PATCH BlueZ v3] " Dmitriy Paliy
2011-08-22 14:02   ` Luiz Augusto von Dentz
2011-08-22 14:06     ` Dmitriy Paliy
2011-08-22 18:12       ` Luiz Augusto von Dentz
2011-08-23 11:59   ` Johan Hedberg

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