Linux bluetooth development
 help / color / mirror / Atom feed
* Re: Any flag indicating bt/fm is ready to run "hcitool cmd"
From: zhangfei gao @ 2011-01-13  6:53 UTC (permalink / raw)
  To: Johan Hedberg, linux-bluetooth
In-Reply-To: <20110112083726.GA28156@jh-x301>

On Wed, Jan 12, 2011 at 3:37 AM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> Hi,
>
> On Wed, Jan 12, 2011, zhangfei gao wrote:
>> Is there any flag indicating bt/fm is ready to run "hcitool cmd", ie,
>> "hciconfig hci0 up" is really finished.
>>
>> We met error "Send failed: File descriptor in bad state", if run
>> hcitool immediately after "hciconfig hci0 up"
>> For example:
>> hciconfig hci0 up
>> hcitool cmd 3f 66 02 26 00 00 00 30
>
> The HCIDEVUP ioctl is at least synchronized with the open() callback for
> the HCI driver so in that sense if the driver is working fine it should
> be possible to send commands when it returns. There is however an issue
> with existing kernels that HCIDEVUP doesn't wait for all of the kernels
> own HCI commands to finish before returning to user space. There was a
> patch sent for this some time ago which you might be interested in
> trying: http://marc.info/?l=linux-bluetooth&m=129296529630642&w=4

Really thanks Johan,
The patch synchronize hci_dev_open, it solve the problem we met, and
"hcitool cmd" could immediately send after "hciconfig hci0 up" without
problem.
By the way, is this patch already in the kernel?

>
> Johan
>

^ permalink raw reply

* Re: compat-wireless-2.6.37-4 is out
From: Luis R. Rodriguez @ 2011-01-13  1:18 UTC (permalink / raw)
  To: linux-wireless; +Cc: Hauke Mehrtens, linux-kernel, linux-bluetooth
In-Reply-To: <AANLkTi=PRg31io9=+i8xYBrn+=ny52tVHW4bLwwiG6tQ@mail.gmail.com>

On Wed, Jan 12, 2011 at 5:11 PM, Luis R. Rodriguez <mcgrof@gmail.com> wrote:
> Thanks to Hauke for his fixes for this release.
>
> http://www.orbit-lab.org/kernel/compat-wireless-2.6-stable/v2.6.37/compat-wireless-2.6.37-4.tar.bz2
> sha1sum: e1b6432ce9e6738e320334b26e4adb68d3dd2a80
>
> http://www.orbit-lab.org/kernel/compat-wireless-2.6-stable/v2.6.37/compat-wireless-2.6.37-4-sn.tar.bz2
> sha1sum: 54b8d777287fdcc7a716d71cfb21884f1ae07157
>
> http://wireless.kernel.org/en/users/Download/stable

Oh and here are the code stats for this release:

compat-wireless code metrics

    739767 - Total upstream lines of code being pulled
      2153 - backport code changes
      1901 - backport code additions
       252 - backport code deletions
      6386 - backport from compat module
      8539 - total backport code
    1.1543 - % of code consists of backport work
       216 - Code changes brought in from pending-stable
       137 - Code additions brought in from pending-stable
        79 - Code deletions brought in from pending-stable
    0.0292 - % of code being cherry picked from pending-stable
       114 - Code changes brought in from linux-next
       102 - Code additions brought in from linux-next
        12 - Code deletions brought in from linux-next
    0.0154 - % of code being cherry picked from linux-next

Base tree: linux-2.6-allstable.git
Base tree version: v2.6.37
compat-wireless release: compat-wireless-v2.6.37-4-sn

  Luis

^ permalink raw reply

* compat-wireless-2.6.37-4 is out
From: Luis R. Rodriguez @ 2011-01-13  1:11 UTC (permalink / raw)
  To: linux-wireless; +Cc: Hauke Mehrtens, linux-kernel, linux-bluetooth

Thanks to Hauke for his fixes for this release.

http://www.orbit-lab.org/kernel/compat-wireless-2.6-stable/v2.6.37/compat-wireless-2.6.37-4.tar.bz2
sha1sum: e1b6432ce9e6738e320334b26e4adb68d3dd2a80

http://www.orbit-lab.org/kernel/compat-wireless-2.6-stable/v2.6.37/compat-wireless-2.6.37-4-sn.tar.bz2
sha1sum: 54b8d777287fdcc7a716d71cfb21884f1ae07157

http://wireless.kernel.org/en/users/Download/stable

  Luis

^ permalink raw reply

* Re: [PATCH] Bluetooth: Check authorization when sec_level goes high.
From: Luiz Augusto von Dentz @ 2011-01-12 22:31 UTC (permalink / raw)
  To: Matti J. Aaltonen; +Cc: linux-bluetooth, marcel, padovan
In-Reply-To: <1294834111-29658-1-git-send-email-matti.j.aaltonen@nokia.com>

Hi,

On Wed, Jan 12, 2011 at 2:08 PM, Matti J. Aaltonen
<matti.j.aaltonen@nokia.com> wrote:
> Initiate authorization check also in cases where the
> security level of an existing connection changes to
> BT_SECURITY_HIGH.
>
> This patch fixes a bug which makes commands bluez-test-device and
> bluez-simple-agent fail, if the latter is given before the connection
> created by bluez-test-device has expired.
>
> Signed-off-by: Matti J. Aaltonen <matti.j.aaltonen@nokia.com>
> ---
> =A0net/bluetooth/hci_conn.c | =A0 13 ++++++++++++-
> =A01 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
> index 0b1e460..5df232b 100644
> --- a/net/bluetooth/hci_conn.c
> +++ b/net/bluetooth/hci_conn.c
> @@ -380,8 +380,19 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, i=
nt type, bdaddr_t *dst, __u8
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0acl->auth_type =3D auth_type;
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0hci_acl_connect(acl);
> =A0 =A0 =A0 =A0} else {
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (acl->sec_level < sec_level)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (acl->sec_level < sec_level) {
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0acl->sec_level =3D sec_lev=
el;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (acl->sec_level =3D=3D B=
T_SECURITY_HIGH) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 struct hci_=
cp_auth_requested ar;
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 acl->state =
=3D BT_CONFIG;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 memset(&ar,=
 0, sizeof(ar));
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ar.handle =
=3D cpu_to_le16(acl->handle);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 hci_send_cm=
d(hdev, HCI_OP_AUTH_REQUESTED,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0sizeof(ar), &ar);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> +
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (acl->auth_type < auth_type)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0acl->auth_type =3D auth_ty=
pe;
> =A0 =A0 =A0 =A0}

I don't think this fixes the problem properly, the authentication
request could have been sent before because other levels might require
it, also Im afraid this can break sockets using the same link since
the state got reseted to BT_CONFIG when it could previously be
BT_CONNECTED, what happens if there a socket in use and the link is
set back to BT_CONFIG after connected?

^ permalink raw reply

* Re: [PATCH] Fix crash after fetching single owner vCard
From: Johan Hedberg @ 2011-01-12 15:46 UTC (permalink / raw)
  To: Rafal Michalski; +Cc: linux-bluetooth
In-Reply-To: <1294845338-15655-1-git-send-email-michalski.raf@gmail.com>

Hi Rafal,

On Wed, Jan 12, 2011, Rafal Michalski wrote:
> This patch makes that crash is avoided in case of fetching single owner
> vCard (0.vcf) from phonebook. Crash was caused because previous
> modifications of other queries wasn't included in query called
> CONTACTS_OTHER_QUERY_FROM_URI.
> ---
>  plugins/phonebook-tracker.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)

Thanks. The patch has been pushed upstream.

Johan

^ permalink raw reply

* [PATCH] Fix crash after fetching single owner vCard
From: Rafal Michalski @ 2011-01-12 15:15 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Rafal Michalski

This patch makes that crash is avoided in case of fetching single owner
vCard (0.vcf) from phonebook. Crash was caused because previous
modifications of other queries wasn't included in query called
CONTACTS_OTHER_QUERY_FROM_URI.
---
 plugins/phonebook-tracker.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index 237fb33..311babd 100644
--- a/plugins/phonebook-tracker.c
+++ b/plugins/phonebook-tracker.c
@@ -757,10 +757,10 @@
 "ORDER BY ?_key tracker:id(<%s>)"
 
 #define CONTACTS_OTHER_QUERY_FROM_URI					\
-	"SELECT \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" "	\
-	"fn:concat(\"TYPE_OTHER\", \"\31\", nco:phoneNumber(?t)) \"\" "	\
+	"SELECT fn:concat(\"TYPE_OTHER\", \"\31\", nco:phoneNumber(?t))"\
+	"\"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" "			\
 	"\"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" \"\" "		\
-	" \"NOTACALL\" \"false\" \"false\" <%s> "	\
+	" \"NOTACALL\" \"false\" \"false\" <%s> "			\
 	"WHERE { "							\
 		"<%s> a nco:Contact . "					\
 		"OPTIONAL { <%s> nco:hasPhoneNumber ?t . } "		\
-- 
1.6.3.3


^ permalink raw reply related

* Re: [PATCH] ath3k: reduce memory usage
From: Bala Shanmugam @ 2011-01-12 13:37 UTC (permalink / raw)
  To: Alexander Holler
  Cc: Gustavo F. Padovan, Marcel Holtmann, SongXing Xu, Luis Rodriguez,
	Vikram Kandukuri, linux-bluetooth@vger.kernel.org
In-Reply-To: <4D2B39B1.8010404@ahsoftware.de>

On 1/10/2011 10:24 PM, Alexander Holler wrote:
> Hello,
>
> because the merge window is currently open, should I resend that patch
> or post it on another mailing list too?
>
> I still think that driver should not waste about 250kb of memory. ;)
>
> Regards,
>
> Alexander
>
> Am 30.11.2010 02:52, schrieb Gustavo F. Padovan:
>> Hi Alexander,
>>
>> * Alexander Holler<holler@ahsoftware.de>   [2010-11-22 21:09:01 +0100]:
>>
>>> There is no need to hold the firmware in memory.
>>>
>>> Signed-off-by: Alexander Holler<holler@ahsoftware.de>
>>> ---
>>>    drivers/bluetooth/ath3k.c |   75 ++++++++++++---------------------------------
>>>    1 files changed, 20 insertions(+), 55 deletions(-)
>>>
>>> diff --git a/drivers/bluetooth/ath3k.c b/drivers/bluetooth/ath3k.c
>>> index 128cae4..81cd1ed 100644
>>> --- a/drivers/bluetooth/ath3k.c
>>> +++ b/drivers/bluetooth/ath3k.c
>>> @@ -43,46 +43,40 @@ MODULE_DEVICE_TABLE(usb, ath3k_table);
>>>    #define USB_REQ_DFU_DNLOAD	1
>>>    #define BULK_SIZE		4096
>>>
>>> -struct ath3k_data {
>>> -	struct usb_device *udev;
>>> -	u8 *fw_data;
>>> -	u32 fw_size;
>>> -	u32 fw_sent;
>>> -};
>>> -
>>> -static int ath3k_load_firmware(struct ath3k_data *data,
>>> -				unsigned char *firmware,
>>> -				int count)
>>> +static int ath3k_load_firmware(struct usb_device *udev,
>>> +				const struct firmware *firmware)
>>>    {
>>>    	u8 *send_buf;
>>>    	int err, pipe, len, size, sent = 0;
>>> +	int count = firmware->size;
>>>
>>> -	BT_DBG("ath3k %p udev %p", data, data->udev);
>>> +	BT_DBG("udev %p", udev);
>>>
>>> -	pipe = usb_sndctrlpipe(data->udev, 0);
>>> +	pipe = usb_sndctrlpipe(udev, 0);
>>>
>>> -	if ((usb_control_msg(data->udev, pipe,
>>> +	send_buf = kmalloc(BULK_SIZE, GFP_ATOMIC);
>>> +	if (!send_buf) {
>>> +		BT_ERR("Can't allocate memory chunk for firmware");
>>> +		return -ENOMEM;
>>> +	}
>>> +
>>> +	memcpy(send_buf, firmware->data, 20);
>>> +	if ((err = usb_control_msg(udev, pipe,
>>>    				USB_REQ_DFU_DNLOAD,
>>>    				USB_TYPE_VENDOR, 0, 0,
>>> -				firmware, 20, USB_CTRL_SET_TIMEOUT))<   0) {
>>> +				send_buf, 20, USB_CTRL_SET_TIMEOUT))<   0) {
>>>    		BT_ERR("Can't change to loading configuration err");
>>> -		return -EBUSY;
>>> +		goto error;
>>>    	}
>>>    	sent += 20;
>>>    	count -= 20;
>> Patch looks good to me,  but I have a question here: what's 20 here? I
>> didn't figured out.
>>
>> Vikram, what's your opinion on this patch? Can you ack/nack it?
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alex,

Sorry for late reply.
Was held up in a work.

I will check your patch and update soon.
Can you send a fresh patch cc to btlinuxmail@gmail.com

Regards,
Bala.

^ permalink raw reply

* [PATCH] Bluetooth: Check authorization when sec_level goes high.
From: Matti J. Aaltonen @ 2011-01-12 12:08 UTC (permalink / raw)
  To: linux-bluetooth, marcel, padovan; +Cc: Matti J. Aaltonen

Initiate authorization check also in cases where the
security level of an existing connection changes to
BT_SECURITY_HIGH.

This patch fixes a bug which makes commands bluez-test-device and
bluez-simple-agent fail, if the latter is given before the connection
created by bluez-test-device has expired.

Signed-off-by: Matti J. Aaltonen <matti.j.aaltonen@nokia.com>
---
 net/bluetooth/hci_conn.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 0b1e460..5df232b 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -380,8 +380,19 @@ struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst, __u8
 		acl->auth_type = auth_type;
 		hci_acl_connect(acl);
 	} else {
-		if (acl->sec_level < sec_level)
+		if (acl->sec_level < sec_level) {
 			acl->sec_level = sec_level;
+			if (acl->sec_level == BT_SECURITY_HIGH) {
+				struct hci_cp_auth_requested ar;
+
+				acl->state = BT_CONFIG;
+				memset(&ar, 0, sizeof(ar));
+				ar.handle = cpu_to_le16(acl->handle);
+				hci_send_cmd(hdev, HCI_OP_AUTH_REQUESTED,
+					     sizeof(ar), &ar);
+			}
+		}
+
 		if (acl->auth_type < auth_type)
 			acl->auth_type = auth_type;
 	}
-- 
1.6.1.3

^ permalink raw reply related

* Re: Any flag indicating bt/fm is ready to run "hcitool cmd"
From: Johan Hedberg @ 2011-01-12  8:37 UTC (permalink / raw)
  To: zhangfei gao; +Cc: linux-bluetooth
In-Reply-To: <AANLkTinFt0Rsbk6LoTk8YnYeqGqzxwTwrWgRakCaQoWo@mail.gmail.com>

Hi,

On Wed, Jan 12, 2011, zhangfei gao wrote:
> Is there any flag indicating bt/fm is ready to run "hcitool cmd", ie,
> "hciconfig hci0 up" is really finished.
> 
> We met error "Send failed: File descriptor in bad state", if run
> hcitool immediately after "hciconfig hci0 up"
> For example:
> hciconfig hci0 up
> hcitool cmd 3f 66 02 26 00 00 00 30

The HCIDEVUP ioctl is at least synchronized with the open() callback for
the HCI driver so in that sense if the driver is working fine it should
be possible to send commands when it returns. There is however an issue
with existing kernels that HCIDEVUP doesn't wait for all of the kernels
own HCI commands to finish before returning to user space. There was a
patch sent for this some time ago which you might be interested in
trying: http://marc.info/?l=linux-bluetooth&m=129296529630642&w=4

Johan

^ permalink raw reply

* RE: [PATCH] HCI Commands for LE White List
From: Sumit Kumar BAJPAI @ 2011-01-12  8:21 UTC (permalink / raw)
  To: Claudio Takahasi; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <AANLkTimZk4FrRBGSp=W1LciZnrwjAqmm3k71tLA4AEYV@mail.gmail.com>

SGkgQ2xhdWRpbywNCg0KIA0KPiBDb3VsZCB5b3UgcGxlYXNlIHNwbGl0IHRoaXMgcGF0Y2ggaW50
byBtaW5vciBmdW5jdGlvbmFsIHBhdGNoZXM/DQpPay4gV291bGQgcmVzdWJtaXQgZm91ciBwYXRj
aGVzIG5vdy1vbmUgZWFjaCBmb3IgQWRkIERldmljZSwgUmVtb3ZlIERldmljZSwgQ2xlYXIgV2hp
dGUgTGlzdCBhbmQgUmVhZCBXaGl0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mVjdGlvbiIs
DQo+IMKgfSwNCj4gPiDCoCDCoCDCoCDCoHsgImxlZGMiLCDCoCBjbWRfbGVkYywgwqAgIkRpc2Nv
bm5lY3QgYSBMRSBDb25uZWN0aW9uIiwNCj4gwqB9LA0KPiA+IMKgIMKgIMKgIMKgeyBOVUxMLCBO
VUxMLCAwIH0NCj4gPiAtLQ0KPiA+IDEuNi41DQo+ID4NCj4gPg0KPiA+IC0tDQo+ID4gVG8gdW5z
dWJzY3JpYmUgZnJvbSB0aGlzIGxpc3Q6IHNlbmQgdGhlIGxpbmUgInVuc3Vic2NyaWJlIGxpbnV4
LQ0KPiBibHVldG9vdGgiIGluDQo+ID4gdGhlIGJvZHkgb2YgYSBtZXNzYWdlIHRvIG1ham9yZG9t
b0B2Z2VyLmtlcm5lbC5vcmcNCj4gPiBNb3JlIG1ham9yZG9tbyBpbmZvIGF0IMKgaHR0cDovL3Zn
ZXIua2VybmVsLm9yZy9tYWpvcmRvbW8taW5mby5odG1sDQo+ID4NCg0KVGhhbmtzLCANClN1bWl0
Lg0K

^ permalink raw reply

* Any flag indicating bt/fm is ready to run "hcitool cmd"
From: zhangfei gao @ 2011-01-12  7:02 UTC (permalink / raw)
  To: linux-bluetooth

Is there any flag indicating bt/fm is ready to run "hcitool cmd", ie,
"hciconfig hci0 up" is really finished.

We met error "Send failed: File descriptor in bad state", if run
hcitool immediately after "hciconfig hci0 up"
For example:
hciconfig hci0 up
hcitool cmd 3f 66 02 26 00 00 00 30

And it could be workaround adding sleep.
The reason is "hciconfig hci0 up" is asynchronous, when it return,
bt/fm is not ready in fact, so add sleep could solve the issue, but
still may fail in stress test since race condition.
We have test bit HCI_UP, but hcitool cmd still would failed, when
HCI_UP=1, which is set in hci_dev_open instead of handler.
How about HCI_RAW?

The question is any bit user place could check and then safe to send
any command via hcitool cmd.

Thanks in advance.

^ permalink raw reply

* Re: [PATCH 1/2] Fix possible memory leak on each a2dp stream setup
From: Johan Hedberg @ 2011-01-11 20:14 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1294756947-11714-1-git-send-email-luiz.dentz@gmail.com>

Hi Luiz,

On Tue, Jan 11, 2011, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
> 
> Setup capabilities were not freed when capabilities were automatically
> generated and not just taken as it used to be with old unix socket
> clients.
> ---
>  audio/a2dp.c |   29 ++++++++++++++++++-----------
>  audio/unix.c |    2 ++
>  2 files changed, 20 insertions(+), 11 deletions(-)

These two patches have also been pushed upstream. Thanks.

Johan

^ permalink raw reply

* Re: [PATCH 1/2 v2] Fix memory leak when calling endpoint method
From: Johan Hedberg @ 2011-01-11 20:13 UTC (permalink / raw)
  To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1294748511-8393-1-git-send-email-luiz.dentz@gmail.com>

Hi Luiz,

On Tue, Jan 11, 2011, Luiz Augusto von Dentz wrote:
> From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>
> 
> The pending call must be unrefed in those cases
> ---
>  audio/media.c |   21 +++++++++++++++------
>  1 files changed, 15 insertions(+), 6 deletions(-)

Both patches have been pushed upstream. Thanks.

Johan

^ permalink raw reply

* [PATCHv2] Bluetooth: Do not use assignments in IF conditions
From: Emeltchenko Andrei @ 2011-01-11 15:20 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1294759220-5002-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>

From: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>

Fix checkpatch warnings concerning assignments in if conditions.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>
---
 net/bluetooth/af_bluetooth.c |    6 ++++--
 net/bluetooth/cmtp/capi.c    |    3 ++-
 net/bluetooth/cmtp/core.c    |    9 ++++++---
 net/bluetooth/hci_core.c     |   12 +++++++++---
 net/bluetooth/hci_event.c    |   22 ++++++++++++++--------
 net/bluetooth/hidp/core.c    |    9 ++++++---
 net/bluetooth/l2cap.c        |    5 ++++-
 7 files changed, 45 insertions(+), 21 deletions(-)

diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c
index c4cf3f5..a6732b5 100644
--- a/net/bluetooth/af_bluetooth.c
+++ b/net/bluetooth/af_bluetooth.c
@@ -240,7 +240,8 @@ int bt_sock_recvmsg(struct kiocb *iocb, struct socket *sock,
 	if (flags & (MSG_OOB))
 		return -EOPNOTSUPP;
 
-	if (!(skb = skb_recv_datagram(sk, flags, noblock, &err))) {
+	skb = skb_recv_datagram(sk, flags, noblock, &err);
+	if (!skb) {
 		if (sk->sk_shutdown & RCV_SHUTDOWN)
 			return 0;
 		return err;
@@ -323,7 +324,8 @@ int bt_sock_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
 			if (copied >= target)
 				break;
 
-			if ((err = sock_error(sk)) != 0)
+			err = sock_error(sk);
+			if (err)
 				break;
 			if (sk->sk_shutdown & RCV_SHUTDOWN)
 				break;
diff --git a/net/bluetooth/cmtp/capi.c b/net/bluetooth/cmtp/capi.c
index 3487cfe..67cff81 100644
--- a/net/bluetooth/cmtp/capi.c
+++ b/net/bluetooth/cmtp/capi.c
@@ -155,7 +155,8 @@ static void cmtp_send_interopmsg(struct cmtp_session *session,
 
 	BT_DBG("session %p subcmd 0x%02x appl %d msgnum %d", session, subcmd, appl, msgnum);
 
-	if (!(skb = alloc_skb(CAPI_MSG_BASELEN + 6 + len, GFP_ATOMIC))) {
+	skb = alloc_skb(CAPI_MSG_BASELEN + 6 + len, GFP_ATOMIC);
+	if (!skb) {
 		BT_ERR("Can't allocate memory for interoperability packet");
 		return;
 	}
diff --git a/net/bluetooth/cmtp/core.c b/net/bluetooth/cmtp/core.c
index 8e5f292..2cee71a 100644
--- a/net/bluetooth/cmtp/core.c
+++ b/net/bluetooth/cmtp/core.c
@@ -115,7 +115,8 @@ static inline void cmtp_add_msgpart(struct cmtp_session *session, int id, const
 
 	size = (skb) ? skb->len + count : count;
 
-	if (!(nskb = alloc_skb(size, GFP_ATOMIC))) {
+	nskb = alloc_skb(size, GFP_ATOMIC);
+	if (!nskb) {
 		BT_ERR("Can't allocate memory for CAPI message");
 		return;
 	}
@@ -216,7 +217,8 @@ static void cmtp_process_transmit(struct cmtp_session *session)
 
 	BT_DBG("session %p", session);
 
-	if (!(nskb = alloc_skb(session->mtu, GFP_ATOMIC))) {
+	nskb = alloc_skb(session->mtu, GFP_ATOMIC);
+	if (!nskb) {
 		BT_ERR("Can't allocate memory for new frame");
 		return;
 	}
@@ -224,7 +226,8 @@ static void cmtp_process_transmit(struct cmtp_session *session)
 	while ((skb = skb_dequeue(&session->transmit))) {
 		struct cmtp_scb *scb = (void *) skb->cb;
 
-		if ((tail = (session->mtu - nskb->len)) < 5) {
+		tail = session->mtu - nskb->len;
+		if (tail < 5) {
 			cmtp_send_frame(session, nskb->data, nskb->len);
 			skb_trim(nskb, 0);
 			tail = session->mtu;
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 8b602d8..bf7f4a7 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -429,7 +429,8 @@ int hci_inquiry(void __user *arg)
 	if (copy_from_user(&ir, ptr, sizeof(ir)))
 		return -EFAULT;
 
-	if (!(hdev = hci_dev_get(ir.dev_id)))
+	hdev = hci_dev_get(ir.dev_id);
+	if (!hdev)
 		return -ENODEV;
 
 	hci_dev_lock_bh(hdev);
@@ -489,7 +490,8 @@ int hci_dev_open(__u16 dev)
 	struct hci_dev *hdev;
 	int ret = 0;
 
-	if (!(hdev = hci_dev_get(dev)))
+	hdev = hci_dev_get(dev);
+	if (!hdev)
 		return -ENODEV;
 
 	BT_DBG("%s %p", hdev->name, hdev);
@@ -1752,7 +1754,11 @@ static void hci_cmd_task(unsigned long arg)
 	}
 
 	/* Send queued commands */
-	if (atomic_read(&hdev->cmd_cnt) && (skb = skb_dequeue(&hdev->cmd_q))) {
+	if (atomic_read(&hdev->cmd_cnt)) {
+		skb = skb_dequeue(&hdev->cmd_q);
+		if (!skb)
+			return;
+
 		kfree_skb(hdev->sent_cmd);
 
 		hdev->sent_cmd = skb_clone(skb, GFP_ATOMIC);
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 3810017..44e8516 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -622,11 +622,14 @@ static void hci_cs_add_sco(struct hci_dev *hdev, __u8 status)
 	hci_dev_lock(hdev);
 
 	acl = hci_conn_hash_lookup_handle(hdev, handle);
-	if (acl && (sco = acl->link)) {
-		sco->state = BT_CLOSED;
+	if (acl) {
+		sco = acl->link;
+		if (sco) {
+			sco->state = BT_CLOSED;
 
-		hci_proto_connect_cfm(sco, status);
-		hci_conn_del(sco);
+			hci_proto_connect_cfm(sco, status);
+			hci_conn_del(sco);
+		}
 	}
 
 	hci_dev_unlock(hdev);
@@ -808,11 +811,14 @@ static void hci_cs_setup_sync_conn(struct hci_dev *hdev, __u8 status)
 	hci_dev_lock(hdev);
 
 	acl = hci_conn_hash_lookup_handle(hdev, handle);
-	if (acl && (sco = acl->link)) {
-		sco->state = BT_CLOSED;
+	if (acl) {
+		sco = acl->link;
+		if (sco) {
+			sco->state = BT_CLOSED;
 
-		hci_proto_connect_cfm(sco, status);
-		hci_conn_del(sco);
+			hci_proto_connect_cfm(sco, status);
+			hci_conn_del(sco);
+		}
 	}
 
 	hci_dev_unlock(hdev);
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 29544c2..e0de929 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -157,7 +157,8 @@ static int hidp_queue_event(struct hidp_session *session, struct input_dev *dev,
 
 	session->leds = newleds;
 
-	if (!(skb = alloc_skb(3, GFP_ATOMIC))) {
+	skb = alloc_skb(3, GFP_ATOMIC);
+	if (!skb) {
 		BT_ERR("Can't allocate memory for new frame");
 		return -ENOMEM;
 	}
@@ -250,7 +251,8 @@ static int __hidp_send_ctrl_message(struct hidp_session *session,
 
 	BT_DBG("session %p data %p size %d", session, data, size);
 
-	if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) {
+	skb = alloc_skb(size + 1, GFP_ATOMIC);
+	if (!skb) {
 		BT_ERR("Can't allocate memory for new frame");
 		return -ENOMEM;
 	}
@@ -283,7 +285,8 @@ static int hidp_queue_report(struct hidp_session *session,
 
 	BT_DBG("session %p hid %p data %p size %d", session, session->hid, data, size);
 
-	if (!(skb = alloc_skb(size + 1, GFP_ATOMIC))) {
+	skb = alloc_skb(size + 1, GFP_ATOMIC);
+	if (!skb) {
 		BT_ERR("Can't allocate memory for new frame");
 		return -ENOMEM;
 	}
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index c791fcd..86fc19c 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -4692,7 +4692,10 @@ static int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 fl
 {
 	struct l2cap_conn *conn = hcon->l2cap_data;
 
-	if (!conn && !(conn = l2cap_conn_add(hcon, 0)))
+	if (!conn)
+		conn = l2cap_conn_add(hcon, 0);
+
+	if (!conn)
 		goto drop;
 
 	BT_DBG("conn %p len %d flags 0x%x", conn, skb->len, flags);
-- 
1.7.1


^ permalink raw reply related

* [PATCHv2] Bluetooth: Fix checkpatch warnings
From: Emeltchenko Andrei @ 2011-01-11 15:20 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@nokia.com>

v2: taking comments from Anderson Lizardo.

Andrei Emeltchenko (1):
  Bluetooth: Do not use assignments in IF conditions

 net/bluetooth/af_bluetooth.c |    6 ++++--
 net/bluetooth/cmtp/capi.c    |    3 ++-
 net/bluetooth/cmtp/core.c    |    9 ++++++---
 net/bluetooth/hci_core.c     |   12 +++++++++---
 net/bluetooth/hci_event.c    |   22 ++++++++++++++--------
 net/bluetooth/hidp/core.c    |    9 ++++++---
 net/bluetooth/l2cap.c        |    5 ++++-
 7 files changed, 45 insertions(+), 21 deletions(-)


^ permalink raw reply

* [PATCH 2/2] Fix memory leak when calling endpoint to select capabilities
From: Luiz Augusto von Dentz @ 2011-01-11 14:42 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1294756947-11714-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>

When passing allocated memory to avdtp_service_cap_new it needs to be
freed since avdtp_service_cap_new copies the memory.
---
 audio/a2dp.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/audio/a2dp.c b/audio/a2dp.c
index c5da708..c1d82bb 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -1833,6 +1833,7 @@ static void select_cb(struct media_endpoint *endpoint, void *ret, int size,
 						sizeof(*cap) + size);
 
 	setup->caps = g_slist_append(setup->caps, media_codec);
+	g_free(cap);
 
 done:
 	finalize_select(setup);
-- 
1.7.1


^ permalink raw reply related

* [PATCH 1/2] Fix possible memory leak on each a2dp stream setup
From: Luiz Augusto von Dentz @ 2011-01-11 14:42 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>

Setup capabilities were not freed when capabilities were automatically
generated and not just taken as it used to be with old unix socket
clients.
---
 audio/a2dp.c |   29 ++++++++++++++++++-----------
 audio/unix.c |    2 ++
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/audio/a2dp.c b/audio/a2dp.c
index b1e94d9..c5da708 100644
--- a/audio/a2dp.c
+++ b/audio/a2dp.c
@@ -94,7 +94,7 @@ struct a2dp_setup {
 	struct avdtp_stream *stream;
 	struct avdtp_error *err;
 	avdtp_set_configuration_cb setconf_cb;
-	GSList *client_caps;
+	GSList *caps;
 	gboolean reconfigure;
 	gboolean start;
 	GSList *cb;
@@ -162,6 +162,8 @@ static void setup_free(struct a2dp_setup *s)
 		avdtp_unref(s->session);
 	g_slist_foreach(s->cb, (GFunc) g_free, NULL);
 	g_slist_free(s->cb);
+	g_slist_foreach(s->caps, (GFunc) g_free, NULL);
+	g_slist_free(s->caps);
 	g_free(s);
 }
 
@@ -277,7 +279,7 @@ static gboolean finalize_suspend_errno(struct a2dp_setup *s, int err)
 	return finalize_suspend(s);
 }
 
-static gboolean finalize_select(struct a2dp_setup *s, GSList *caps)
+static gboolean finalize_select(struct a2dp_setup *s)
 {
 	GSList *l;
 
@@ -289,7 +291,7 @@ static gboolean finalize_select(struct a2dp_setup *s, GSList *caps)
 		if (!cb->select_cb)
 			continue;
 
-		cb->select_cb(s->session, s->sep, caps, cb->user_data);
+		cb->select_cb(s->session, s->sep, s->caps, cb->user_data);
 		setup_cb_free(cb);
 	}
 
@@ -1060,7 +1062,7 @@ static gboolean a2dp_reconfigure(gpointer data)
 
 	posix_err = avdtp_set_configuration(setup->session, setup->rsep,
 						sep->lsep,
-						setup->client_caps,
+						setup->caps,
 						&setup->stream);
 	if (posix_err < 0) {
 		error("avdtp_set_configuration: %s", strerror(-posix_err));
@@ -1811,7 +1813,6 @@ static void select_cb(struct media_endpoint *endpoint, void *ret, int size,
 	struct a2dp_setup *setup = user_data;
 	struct avdtp_service_capability *media_transport, *media_codec;
 	struct avdtp_media_codec_capability *cap;
-	GSList *caps = NULL;
 
 	if (size < 0) {
 		DBG("Endpoint replied an invalid configuration");
@@ -1821,7 +1822,7 @@ static void select_cb(struct media_endpoint *endpoint, void *ret, int size,
 	media_transport = avdtp_service_cap_new(AVDTP_MEDIA_TRANSPORT,
 						NULL, 0);
 
-	caps = g_slist_append(caps, media_transport);
+	setup->caps = g_slist_append(setup->caps, media_transport);
 
 	cap = g_malloc0(sizeof(*cap) + size);
 	cap->media_type = AVDTP_MEDIA_TYPE_AUDIO;
@@ -1831,17 +1832,17 @@ static void select_cb(struct media_endpoint *endpoint, void *ret, int size,
 	media_codec = avdtp_service_cap_new(AVDTP_MEDIA_CODEC, cap,
 						sizeof(*cap) + size);
 
-	caps = g_slist_append(caps, media_codec);
+	setup->caps = g_slist_append(setup->caps, media_codec);
 
 done:
-	finalize_select(setup, caps);
+	finalize_select(setup);
 }
 
 static gboolean auto_select(gpointer data)
 {
 	struct a2dp_setup *setup = data;
 
-	finalize_select(setup, setup->client_caps);
+	finalize_select(setup);
 
 	return FALSE;
 }
@@ -1933,7 +1934,7 @@ unsigned int a2dp_select_capabilities(struct avdtp *session,
 	endpoint in the configuration file */
 	if (sep->endpoint == NULL) {
 		if (!select_capabilities(session, setup->rsep,
-					&setup->client_caps)) {
+					&setup->caps)) {
 			error("Unable to auto select remote SEP capabilities");
 			goto fail;
 		}
@@ -2006,7 +2007,13 @@ unsigned int a2dp_config(struct avdtp *session, struct a2dp_sep *sep,
 
 	setup->sep = sep;
 	setup->stream = sep->stream;
-	setup->client_caps = caps;
+
+	/* Copy given caps if they are different than current caps */
+	if (setup->caps != caps) {
+		g_slist_foreach(setup->caps, (GFunc) g_free, NULL);
+		g_slist_free(setup->caps);
+		setup->caps = g_slist_copy(caps);
+	}
 
 	switch (avdtp_sep_get_state(sep->lsep)) {
 	case AVDTP_STATE_IDLE:
diff --git a/audio/unix.c b/audio/unix.c
index 62eee31..76c68a8 100644
--- a/audio/unix.c
+++ b/audio/unix.c
@@ -1074,6 +1074,8 @@ static void start_config(struct audio_device *dev, struct unix_client *client)
 	}
 
 	client->req_id = id;
+	g_slist_free(client->caps);
+	client->caps = NULL;
 
 	return;
 
-- 
1.7.1


^ permalink raw reply related

* Re: [PATCH] Fix history queries for contacts outside pb
From: Johan Hedberg @ 2011-01-11 13:42 UTC (permalink / raw)
  To: Radoslaw Jablonski; +Cc: linux-bluetooth
In-Reply-To: <1294752951-27299-1-git-send-email-ext-jablonski.radoslaw@nokia.com>

Hi Radek,

On Tue, Jan 11, 2011, Radoslaw Jablonski wrote:
> Phone number for contacts outside phonebook need to
> be fetched differently - application which saves call data
> saves this number directly in "nco:Contact" now.
> Without this fix, calls to/from numbers outside phonebook
> won't be listed in call history results
> ---
>  plugins/phonebook-tracker.c |   32 ++++++++++++++++++++++++--------
>  1 files changed, 24 insertions(+), 8 deletions(-)

The patch has been pushed upstream. Thanks.

Johan

^ permalink raw reply

* [PATCH] Fix history queries for contacts outside pb
From: Radoslaw Jablonski @ 2011-01-11 13:35 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Radoslaw Jablonski

Phone number for contacts outside phonebook need to
be fetched differently - application which saves call data
saves this number directly in "nco:Contact" now.
Without this fix, calls to/from numbers outside phonebook
won't be listed in call history results
---
 plugins/phonebook-tracker.c |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/plugins/phonebook-tracker.c b/plugins/phonebook-tracker.c
index 25eca62..237fb33 100644
--- a/plugins/phonebook-tracker.c
+++ b/plugins/phonebook-tracker.c
@@ -152,8 +152,12 @@
 "(SELECT fn:concat(rdf:type(?role_number),"				\
 	"\"\31\", nco:phoneNumber(?role_number))"			\
 	"WHERE {"							\
-	"?_role nco:hasPhoneNumber ?role_number "			\
-	"FILTER (?role_number = ?_number)"				\
+	"{"								\
+	"	?_role nco:hasPhoneNumber ?role_number "		\
+	"	FILTER (?role_number = ?_number)"			\
+	"} UNION { "							\
+		"?_unb_contact nco:hasPhoneNumber ?role_number . "	\
+	"}"								\
 "} GROUP BY nco:phoneNumber(?role_number) ) "				\
 	"nco:fullname(?_contact) "					\
 	"nco:nameFamily(?_contact) "					\
@@ -278,8 +282,12 @@
 "(SELECT fn:concat(rdf:type(?role_number),"				\
 	"\"\31\", nco:phoneNumber(?role_number))"			\
 	"WHERE {"							\
-	"?_role nco:hasPhoneNumber ?role_number "			\
-	"FILTER (?role_number = ?_number)"				\
+	"{"								\
+	"	?_role nco:hasPhoneNumber ?role_number "		\
+	"	FILTER (?role_number = ?_number)"			\
+	"} UNION { "							\
+		"?_unb_contact nco:hasPhoneNumber ?role_number . "	\
+	"}"								\
 "} GROUP BY nco:phoneNumber(?role_number) ) "				\
 	"nco:fullname(?_contact) "					\
 	"nco:nameFamily(?_contact) "					\
@@ -403,8 +411,12 @@
 "(SELECT fn:concat(rdf:type(?role_number),"				\
 	"\"\31\", nco:phoneNumber(?role_number))"			\
 	"WHERE {"							\
-	"?_role nco:hasPhoneNumber ?role_number "			\
-	"FILTER (?role_number = ?_number)"				\
+	"{"								\
+	"	?_role nco:hasPhoneNumber ?role_number "		\
+	"	FILTER (?role_number = ?_number)"			\
+	"} UNION { "							\
+		"?_unb_contact nco:hasPhoneNumber ?role_number . "	\
+	"}"								\
 "} GROUP BY nco:phoneNumber(?role_number) ) "				\
 	"nco:fullname(?_contact) "					\
 	"nco:nameFamily(?_contact) "					\
@@ -522,8 +534,12 @@
 "(SELECT fn:concat(rdf:type(?role_number),"				\
 	"\"\31\", nco:phoneNumber(?role_number))"			\
 	"WHERE {"							\
-	"?_role nco:hasPhoneNumber ?role_number "			\
-	"FILTER (?role_number = ?_number)"				\
+	"{"								\
+	"	?_role nco:hasPhoneNumber ?role_number "		\
+	"	FILTER (?role_number = ?_number)"			\
+	"} UNION { "							\
+		"?_unb_contact nco:hasPhoneNumber ?role_number . "	\
+	"}"								\
 "} GROUP BY nco:phoneNumber(?role_number) ) "				\
 	"nco:fullname(?_contact) "					\
 	"nco:nameFamily(?_contact) "					\
-- 
1.7.0.4


^ permalink raw reply related

* [PATCH 1/2 v2] Fix memory leak when calling endpoint method
From: Luiz Augusto von Dentz @ 2011-01-11 12:21 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>

The pending call must be unrefed in those cases
---
 audio/media.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/audio/media.c b/audio/media.c
index 97a60a1..402709a 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -87,12 +87,23 @@ static GSList *adapters = NULL;
 static void endpoint_request_free(struct endpoint_request *request)
 {
 	if (request->call)
-		dbus_pending_call_cancel(request->call);
+		dbus_pending_call_unref(request->call);
 
 	dbus_message_unref(request->msg);
 	g_free(request);
 }
 
+static void media_endpoint_cancel(struct media_endpoint *endpoint)
+{
+	struct endpoint_request *request = endpoint->request;
+
+	if (request->call)
+		dbus_pending_call_cancel(request->call);
+
+	endpoint_request_free(request);
+	endpoint->request = NULL;
+}
+
 static void media_endpoint_remove(struct media_endpoint *endpoint)
 {
 	struct media_adapter *adapter = endpoint->adapter;
@@ -109,7 +120,7 @@ static void media_endpoint_remove(struct media_endpoint *endpoint)
 		headset_remove_state_cb(endpoint->hs_watch);
 
 	if (endpoint->request)
-		endpoint_request_free(endpoint->request);
+		media_endpoint_cancel(endpoint);
 
 	if (endpoint->transport)
 		media_transport_remove(endpoint->transport);
@@ -613,10 +624,8 @@ void media_endpoint_clear_configuration(struct media_endpoint *endpoint)
 	if (endpoint->transport == NULL)
 		return;
 
-	if (endpoint->request) {
-		endpoint_request_free(endpoint->request);
-		endpoint->request = NULL;
-	}
+	if (endpoint->request)
+		media_endpoint_cancel(endpoint);
 
 	conn = endpoint->adapter->conn;
 
-- 
1.7.1


^ permalink raw reply related

* [PATCH 2/2] Fix possible memory leak when handling avdtp transport connection
From: Luiz Augusto von Dentz @ 2011-01-11 11:54 UTC (permalink / raw)
  To: linux-bluetooth
In-Reply-To: <1294746858-27973-1-git-send-email-luiz.dentz@gmail.com>

From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>

When acting as initiator stream io already has a reference to io channel
to be able to cancel if necessary.
---
 audio/avdtp.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/audio/avdtp.c b/audio/avdtp.c
index 0d50627..fdac1e3 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -895,7 +895,9 @@ static void handle_transport_connect(struct avdtp *session, GIOChannel *io,
 		return;
 	}
 
-	stream->io = g_io_channel_ref(io);
+	if (stream->io == NULL)
+		stream->io = g_io_channel_ref(io);
+
 	stream->omtu = omtu;
 	stream->imtu = imtu;
 
-- 
1.7.1


^ permalink raw reply related

* [PATCH 1/2] Fix memory leak when calling endpoint method
From: Luiz Augusto von Dentz @ 2011-01-11 11:54 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.dentz-von@nokia.com>

The pending call must be unrefed in those cases
---
 audio/media.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/audio/media.c b/audio/media.c
index 97a60a1..03647f5 100644
--- a/audio/media.c
+++ b/audio/media.c
@@ -87,12 +87,23 @@ static GSList *adapters = NULL;
 static void endpoint_request_free(struct endpoint_request *request)
 {
 	if (request->call)
-		dbus_pending_call_cancel(request->call);
+		dbus_pending_call_unref(request->call);
 
 	dbus_message_unref(request->msg);
 	g_free(request);
 }
 
+static void media_endpoint_cancel(struct media_endpoint *endpoint)
+{
+	struct endpoint_request *request = endpoint->request;
+
+	if (request->call)
+		dbus_pending_call_unref(request->call);
+
+	endpoint_request_free(request);
+	endpoint->request = NULL;
+}
+
 static void media_endpoint_remove(struct media_endpoint *endpoint)
 {
 	struct media_adapter *adapter = endpoint->adapter;
@@ -109,7 +120,7 @@ static void media_endpoint_remove(struct media_endpoint *endpoint)
 		headset_remove_state_cb(endpoint->hs_watch);
 
 	if (endpoint->request)
-		endpoint_request_free(endpoint->request);
+		media_endpoint_cancel(endpoint);
 
 	if (endpoint->transport)
 		media_transport_remove(endpoint->transport);
@@ -613,10 +624,8 @@ void media_endpoint_clear_configuration(struct media_endpoint *endpoint)
 	if (endpoint->transport == NULL)
 		return;
 
-	if (endpoint->request) {
-		endpoint_request_free(endpoint->request);
-		endpoint->request = NULL;
-	}
+	if (endpoint->request)
+		media_endpoint_cancel(endpoint);
 
 	conn = endpoint->adapter->conn;
 
-- 
1.7.1


^ permalink raw reply related

* Re: [PATCHv4] Bluetooth: Use non-flushable by default L2CAP data packets
From: Andrei Emeltchenko @ 2011-01-11  8:40 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <AANLkTik_xC9M+MneZnnozXdwYYJ+keSVoxmCreg9TkQz@mail.gmail.com>

Hi Anderson,

On Mon, Jan 10, 2011 at 6:38 PM, Anderson Lizardo
<anderson.lizardo@openbossa.org> wrote:
> Hi Andrei,
>
> On Mon, Jan 3, 2011 at 5:14 AM, Emeltchenko Andrei
> <Andrei.Emeltchenko.news@gmail.com> wrote:
>> diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
>> index c791fcd..ff191b9 100644
>> --- a/net/bluetooth/l2cap.c
>> +++ b/net/bluetooth/l2cap.c
>> @@ -362,13 +362,19 @@ static inline u8 l2cap_get_ident(struct l2cap_conn *conn)
>>  static inline void l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16 len, void *data)
>>  {
>>        struct sk_buff *skb = l2cap_build_cmd(conn, code, ident, len, data);
>> +       u8 flags;
>>
>>        BT_DBG("code 0x%2.2x", code);
>>
>>        if (!skb)
>>                return;
>>
>> -       hci_send_acl(conn->hcon, skb, 0);
>> +       if (lmp_no_flush_capable(conn->hcon->hdev))
>> +               flags = ACL_START_NO_FLUSH;
>> +       else
>> +               flags = ACL_START;
>> +
>> +       hci_send_acl(conn->hcon, skb, flags);
>>  }
>
> Looks like you can't control the "no flush" flag here using the new
> BT_FLUSHABLE setsockopt() option.

The flag is used when sending data packets, when sending l2cap commands we
set ACL_START_NO_FLUSH when host supports it.

Regards,
Andrei

>> @@ -414,7 +421,12 @@ static inline void l2cap_send_sframe(struct l2cap_pinfo *pi, u16 control)
>>                put_unaligned_le16(fcs, skb_put(skb, 2));
>>        }
>>
>> -       hci_send_acl(pi->conn->hcon, skb, 0);
>> +       if (lmp_no_flush_capable(conn->hcon->hdev))
>> +               flags = ACL_START_NO_FLUSH;
>> +       else
>> +               flags = ACL_START;
>> +
>> +       hci_send_acl(pi->conn->hcon, skb, flags);
>>  }
>
> Same here.
>
> Regards,
> --
> Anderson Lizardo
> OpenBossa Labs - INdT
> Manaus - Brazil
>

^ permalink raw reply

* Re: [PATCH] Bluetooth: Do not use assignments in IF conditions
From: Andrei Emeltchenko @ 2011-01-11  8:21 UTC (permalink / raw)
  To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <AANLkTimoBiCHAgyLVEin4C_kFnzqGF_LyG312h-wM5fP@mail.gmail.com>

Hi Anderson,

On Mon, Jan 10, 2011 at 6:25 PM, Anderson Lizardo
<anderson.lizardo@openbossa.org> wrote:
> Hi Andrei,
>
> On Mon, Jan 10, 2011 at 11:12 AM, Emeltchenko Andrei
> <Andrei.Emeltchenko.news@gmail.com> wrote:
>> @@ -224,7 +226,8 @@ static void cmtp_process_transmit(struct cmtp_session *session)
>>        while ((skb = skb_dequeue(&session->transmit))) {
>>                struct cmtp_scb *scb = (void *) skb->cb;
>>
>> -               if ((tail = (session->mtu - nskb->len)) < 5) {
>> +               tail = (session->mtu - nskb->len);
>
> You can drop the parenthesis above.
>
>> +               if (tail < 5) {
>>                        cmtp_send_frame(session, nskb->data, nskb->len);
>>                        skb_trim(nskb, 0);
>>                        tail = session->mtu;
>
>> diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
>> index c791fcd..3f080fa 100644
>> --- a/net/bluetooth/l2cap.c
>> +++ b/net/bluetooth/l2cap.c
>> @@ -4692,7 +4692,11 @@ static int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 fl
>>  {
>>        struct l2cap_conn *conn = hcon->l2cap_data;
>>
>> -       if (!conn && !(conn = l2cap_conn_add(hcon, 0)))
>> +       if (!conn)
>> +               goto drop;
>> +
>> +       conn = l2cap_conn_add(hcon, 0);
>> +       if (!conn)
>>                goto drop;
>
> I think the logic has been changed here. If hcon->l2cap_data is NULL,
> it should try  l2cap_conn_add(hcon, 0), and if that fails, it goes to
> drop. E.g.:
>
> ###
> if (!conn)
>     conn = l2cap_conn_add(hcon, 0);
>
> if (!conn)
>    goto drop;
> ###

will fix this, thanks for the review.

Regards,
Andrei

>
> Regards,
> --
> Anderson Lizardo
> OpenBossa Labs - INdT
> Manaus - Brazil
>

^ permalink raw reply

* pull request git://git.infradead.org/users/vcgomes/linux-2.6.git for-next
From: Vinicius Costa Gomes @ 2011-01-11  0:38 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: padovan

Hi Gustavo,

Here is the SMP implementation. Changes from the last RFC include:

- the fixes requested in the previous round of review;
- support for a simple pairing features exchange;
- SMP timeout;
- a new Kconfig option;

Any problems or improvements let me know, also, if you prefer this as a patch
series.


The following changes since commit 33af88138b859f515b365a074e0a014d7cdbf846:

  ath9k: correct MODULE_PARM_DESC parameters for force_new_ani (2011-01-05 14:36:33 -0500)

are available in the git repository at:
  git://git.infradead.org/users/vcgomes/linux-2.6.git for-next

Anderson Briglia (8):
      Bluetooth: Rename l2cap.c
      Bluetooth: Implement the first SMP commands
      Bluetooth: Start SMP procedure
      Bluetooth: simple SMP pairing negotiation
      Bluetooth: LE SMP Cryptoolbox functions
      Bluetooth: Add SMP confirmation structs
      Bluetooth: Add SMP confirmation checks methods
      Bluetooth: Minor fix in SMP methods

Ville Tervo (8):
      Bluetooth: Add low energy commands and events
      Bluetooth: Add LE connect support
      Bluetooth: Use LE buffers for LE traffic
      Bluetooth: Add LE connection support to L2CAP
      Bluetooth: Add server socket support for LE connection
      Bluetooth: Do not send disconn comand over LE links
      Bluetooth: Treat LE and ACL links separately on timeout
      Bluetooth: Add SMP command structures

Vinicius Costa Gomes (6):
      Bluetooth: Fix initiated LE connections
      Bluetooth: Add support for using the crypto subsystem
      Bluetooth: Add support for LE Start Encryption
      Bluetooth: Add support for resuming socket when SMP is finished
      Bluetooth: Add support for Pairing features exchange
      Bluetooth: Add support for SMP timeout

 include/net/bluetooth/hci.h             |   86 +++++
 include/net/bluetooth/hci_core.h        |   37 ++-
 include/net/bluetooth/l2cap.h           |   11 +
 include/net/bluetooth/smp.h             |   97 ++++++
 net/bluetooth/Kconfig                   |   12 +
 net/bluetooth/Makefile                  |    1 +
 net/bluetooth/hci_conn.c                |  110 ++++++-
 net/bluetooth/hci_core.c                |  102 ++++++-
 net/bluetooth/hci_event.c               |  200 ++++++++++++
 net/bluetooth/{l2cap.c => l2cap_core.c} |  293 +++++++++++++-----
 net/bluetooth/smp.c                     |  518 +++++++++++++++++++++++++++++++
 11 files changed, 1377 insertions(+), 90 deletions(-)
 create mode 100644 include/net/bluetooth/smp.h
 rename net/bluetooth/{l2cap.c => l2cap_core.c} (96%)
 create mode 100644 net/bluetooth/smp.c


Cheers,
-- 
Vinicius

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox