* [PATCH 1/2] Bluetooth: Use GFP_KERNEL in user context
From: Gustavo F. Padovan @ 2011-04-04 22:08 UTC (permalink / raw)
To: linux-bluetooth
Some of the allocations in the mgmt code are in user context, so it's no
recommended the use of GFP_ATOMIC there.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
---
net/bluetooth/mgmt.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 9a61320..bab8b58 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -133,7 +133,7 @@ static int read_index_list(struct sock *sk)
}
rp_len = sizeof(*rp) + (2 * count);
- rp = kmalloc(rp_len, GFP_ATOMIC);
+ rp = kmalloc(rp_len, GFP_KERNEL);
if (!rp) {
read_unlock(&hci_dev_list_lock);
return -ENOMEM;
@@ -226,14 +226,14 @@ static struct pending_cmd *mgmt_pending_add(struct sock *sk, u16 opcode,
{
struct pending_cmd *cmd;
- cmd = kmalloc(sizeof(*cmd), GFP_ATOMIC);
+ cmd = kmalloc(sizeof(*cmd), GFP_KERNEL);
if (!cmd)
return NULL;
cmd->opcode = opcode;
cmd->index = index;
- cmd->param = kmalloc(len, GFP_ATOMIC);
+ cmd->param = kmalloc(len, GFP_KERNEL);
if (!cmd->param) {
kfree(cmd);
return NULL;
@@ -741,7 +741,7 @@ static int add_uuid(struct sock *sk, u16 index, unsigned char *data, u16 len)
hci_dev_lock_bh(hdev);
- uuid = kmalloc(sizeof(*uuid), GFP_ATOMIC);
+ uuid = kmalloc(sizeof(*uuid), GFP_KERNEL);
if (!uuid) {
err = -ENOMEM;
goto failed;
@@ -1081,7 +1081,7 @@ static int get_connections(struct sock *sk, u16 index)
}
rp_len = sizeof(*rp) + (count * sizeof(bdaddr_t));
- rp = kmalloc(rp_len, GFP_ATOMIC);
+ rp = kmalloc(rp_len, GFP_KERNEL);
if (!rp) {
err = -ENOMEM;
goto unlock;
@@ -1581,7 +1581,7 @@ int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen)
if (msglen < sizeof(*hdr))
return -EINVAL;
- buf = kmalloc(msglen, GFP_ATOMIC);
+ buf = kmalloc(msglen, GFP_KERNEL);
if (!buf)
return -ENOMEM;
--
1.7.4.1
^ permalink raw reply related
* [PATCH 2/2] Bluetooth: Don't use spin_lock_bh in user context
From: Gustavo F. Padovan @ 2011-04-04 22:08 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1301954883-13326-1-git-send-email-padovan@profusion.mobi>
spin_lock() and spin_unlock() are more apropiated for user context.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
---
net/bluetooth/mgmt.c | 88 +++++++++++++++++++++++++-------------------------
1 files changed, 44 insertions(+), 44 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index bab8b58..d39abe9 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -179,7 +179,7 @@ static int read_controller_info(struct sock *sk, u16 index)
hci_del_off_timer(hdev);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
set_bit(HCI_MGMT, &hdev->flags);
@@ -208,7 +208,7 @@ static int read_controller_info(struct sock *sk, u16 index)
memcpy(rp.name, hdev->dev_name, sizeof(hdev->dev_name));
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return cmd_complete(sk, index, MGMT_OP_READ_INFO, &rp, sizeof(rp));
@@ -316,7 +316,7 @@ static int set_powered(struct sock *sk, u16 index, unsigned char *data, u16 len)
if (!hdev)
return cmd_status(sk, index, MGMT_OP_SET_POWERED, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
up = test_bit(HCI_UP, &hdev->flags);
if ((cp->val && up) || (!cp->val && !up)) {
@@ -343,7 +343,7 @@ static int set_powered(struct sock *sk, u16 index, unsigned char *data, u16 len)
err = 0;
failed:
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
}
@@ -368,7 +368,7 @@ static int set_discoverable(struct sock *sk, u16 index, unsigned char *data,
if (!hdev)
return cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE, ENETDOWN);
@@ -403,7 +403,7 @@ static int set_discoverable(struct sock *sk, u16 index, unsigned char *data,
mgmt_pending_remove(cmd);
failed:
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -429,7 +429,7 @@ static int set_connectable(struct sock *sk, u16 index, unsigned char *data,
if (!hdev)
return cmd_status(sk, index, MGMT_OP_SET_CONNECTABLE, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, MGMT_OP_SET_CONNECTABLE, ENETDOWN);
@@ -463,7 +463,7 @@ static int set_connectable(struct sock *sk, u16 index, unsigned char *data,
mgmt_pending_remove(cmd);
failed:
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -522,7 +522,7 @@ static int set_pairable(struct sock *sk, u16 index, unsigned char *data,
if (!hdev)
return cmd_status(sk, index, MGMT_OP_SET_PAIRABLE, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
if (cp->val)
set_bit(HCI_PAIRABLE, &hdev->flags);
@@ -538,7 +538,7 @@ static int set_pairable(struct sock *sk, u16 index, unsigned char *data,
err = mgmt_event(MGMT_EV_PAIRABLE, index, &ev, sizeof(ev), sk);
failed:
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -739,7 +739,7 @@ static int add_uuid(struct sock *sk, u16 index, unsigned char *data, u16 len)
if (!hdev)
return cmd_status(sk, index, MGMT_OP_ADD_UUID, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
uuid = kmalloc(sizeof(*uuid), GFP_KERNEL);
if (!uuid) {
@@ -763,7 +763,7 @@ static int add_uuid(struct sock *sk, u16 index, unsigned char *data, u16 len)
err = cmd_complete(sk, index, MGMT_OP_ADD_UUID, NULL, 0);
failed:
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -788,7 +788,7 @@ static int remove_uuid(struct sock *sk, u16 index, unsigned char *data, u16 len)
if (!hdev)
return cmd_status(sk, index, MGMT_OP_REMOVE_UUID, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
if (memcmp(cp->uuid, bt_uuid_any, 16) == 0) {
err = hci_uuids_clear(hdev);
@@ -823,7 +823,7 @@ static int remove_uuid(struct sock *sk, u16 index, unsigned char *data, u16 len)
err = cmd_complete(sk, index, MGMT_OP_REMOVE_UUID, NULL, 0);
unlock:
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -847,7 +847,7 @@ static int set_dev_class(struct sock *sk, u16 index, unsigned char *data,
if (!hdev)
return cmd_status(sk, index, MGMT_OP_SET_DEV_CLASS, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
hdev->major_class = cp->major;
hdev->minor_class = cp->minor;
@@ -857,7 +857,7 @@ static int set_dev_class(struct sock *sk, u16 index, unsigned char *data,
if (err == 0)
err = cmd_complete(sk, index, MGMT_OP_SET_DEV_CLASS, NULL, 0);
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -879,7 +879,7 @@ static int set_service_cache(struct sock *sk, u16 index, unsigned char *data,
if (!hdev)
return cmd_status(sk, index, MGMT_OP_SET_SERVICE_CACHE, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
BT_DBG("hci%u enable %d", index, cp->enable);
@@ -897,7 +897,7 @@ static int set_service_cache(struct sock *sk, u16 index, unsigned char *data,
err = cmd_complete(sk, index, MGMT_OP_SET_SERVICE_CACHE, NULL,
0);
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -931,7 +931,7 @@ static int load_keys(struct sock *sk, u16 index, unsigned char *data, u16 len)
BT_DBG("hci%u debug_keys %u key_count %u", index, cp->debug_keys,
key_count);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
hci_link_keys_clear(hdev);
@@ -949,7 +949,7 @@ static int load_keys(struct sock *sk, u16 index, unsigned char *data, u16 len)
key->pin_len);
}
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return 0;
@@ -971,7 +971,7 @@ static int remove_key(struct sock *sk, u16 index, unsigned char *data, u16 len)
if (!hdev)
return cmd_status(sk, index, MGMT_OP_REMOVE_KEY, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
err = hci_remove_link_key(hdev, &cp->bdaddr);
if (err < 0) {
@@ -994,7 +994,7 @@ static int remove_key(struct sock *sk, u16 index, unsigned char *data, u16 len)
}
unlock:
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -1020,7 +1020,7 @@ static int disconnect(struct sock *sk, u16 index, unsigned char *data, u16 len)
if (!hdev)
return cmd_status(sk, index, MGMT_OP_DISCONNECT, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, MGMT_OP_DISCONNECT, ENETDOWN);
@@ -1052,7 +1052,7 @@ static int disconnect(struct sock *sk, u16 index, unsigned char *data, u16 len)
mgmt_pending_remove(cmd);
failed:
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -1073,7 +1073,7 @@ static int get_connections(struct sock *sk, u16 index)
if (!hdev)
return cmd_status(sk, index, MGMT_OP_GET_CONNECTIONS, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
count = 0;
list_for_each(p, &hdev->conn_hash.list) {
@@ -1104,7 +1104,7 @@ static int get_connections(struct sock *sk, u16 index)
unlock:
kfree(rp);
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
}
@@ -1129,7 +1129,7 @@ static int pin_code_reply(struct sock *sk, u16 index, unsigned char *data,
if (!hdev)
return cmd_status(sk, index, MGMT_OP_PIN_CODE_REPLY, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, MGMT_OP_PIN_CODE_REPLY, ENETDOWN);
@@ -1151,7 +1151,7 @@ static int pin_code_reply(struct sock *sk, u16 index, unsigned char *data,
mgmt_pending_remove(cmd);
failed:
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -1178,7 +1178,7 @@ static int pin_code_neg_reply(struct sock *sk, u16 index, unsigned char *data,
return cmd_status(sk, index, MGMT_OP_PIN_CODE_NEG_REPLY,
ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, MGMT_OP_PIN_CODE_NEG_REPLY,
@@ -1199,7 +1199,7 @@ static int pin_code_neg_reply(struct sock *sk, u16 index, unsigned char *data,
mgmt_pending_remove(cmd);
failed:
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -1222,14 +1222,14 @@ static int set_io_capability(struct sock *sk, u16 index, unsigned char *data,
if (!hdev)
return cmd_status(sk, index, MGMT_OP_SET_IO_CAPABILITY, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
hdev->io_capability = cp->io_capability;
BT_DBG("%s IO capability set to 0x%02x", hdev->name,
hdev->io_capability);
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return cmd_complete(sk, index, MGMT_OP_SET_IO_CAPABILITY, NULL, 0);
@@ -1315,7 +1315,7 @@ static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len)
if (!hdev)
return cmd_status(sk, index, MGMT_OP_PAIR_DEVICE, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
if (cp->io_cap == 0x03) {
sec_level = BT_SECURITY_MEDIUM;
@@ -1357,7 +1357,7 @@ static int pair_device(struct sock *sk, u16 index, unsigned char *data, u16 len)
err = 0;
unlock:
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -1389,7 +1389,7 @@ static int user_confirm_reply(struct sock *sk, u16 index, unsigned char *data,
if (!hdev)
return cmd_status(sk, index, mgmt_op, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, mgmt_op, ENETDOWN);
@@ -1407,7 +1407,7 @@ static int user_confirm_reply(struct sock *sk, u16 index, unsigned char *data,
mgmt_pending_remove(cmd);
failed:
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -1431,7 +1431,7 @@ static int set_local_name(struct sock *sk, u16 index, unsigned char *data,
if (!hdev)
return cmd_status(sk, index, MGMT_OP_SET_LOCAL_NAME, ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
cmd = mgmt_pending_add(sk, MGMT_OP_SET_LOCAL_NAME, index, data, len);
if (!cmd) {
@@ -1446,7 +1446,7 @@ static int set_local_name(struct sock *sk, u16 index, unsigned char *data,
mgmt_pending_remove(cmd);
failed:
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -1465,7 +1465,7 @@ static int read_local_oob_data(struct sock *sk, u16 index)
return cmd_status(sk, index, MGMT_OP_READ_LOCAL_OOB_DATA,
ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
if (!test_bit(HCI_UP, &hdev->flags)) {
err = cmd_status(sk, index, MGMT_OP_READ_LOCAL_OOB_DATA,
@@ -1495,7 +1495,7 @@ static int read_local_oob_data(struct sock *sk, u16 index)
mgmt_pending_remove(cmd);
unlock:
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -1519,7 +1519,7 @@ static int add_remote_oob_data(struct sock *sk, u16 index, unsigned char *data,
return cmd_status(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA,
ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
err = hci_add_remote_oob_data(hdev, &cp->bdaddr, cp->hash,
cp->randomizer);
@@ -1529,7 +1529,7 @@ static int add_remote_oob_data(struct sock *sk, u16 index, unsigned char *data,
err = cmd_complete(sk, index, MGMT_OP_ADD_REMOTE_OOB_DATA, NULL,
0);
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
@@ -1553,7 +1553,7 @@ static int remove_remote_oob_data(struct sock *sk, u16 index,
return cmd_status(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA,
ENODEV);
- hci_dev_lock_bh(hdev);
+ hci_dev_lock(hdev);
err = hci_remove_remote_oob_data(hdev, &cp->bdaddr);
if (err < 0)
@@ -1563,7 +1563,7 @@ static int remove_remote_oob_data(struct sock *sk, u16 index,
err = cmd_complete(sk, index, MGMT_OP_REMOVE_REMOTE_OOB_DATA,
NULL, 0);
- hci_dev_unlock_bh(hdev);
+ hci_dev_unlock(hdev);
hci_dev_put(hdev);
return err;
--
1.7.4.1
^ permalink raw reply related
* Low Energy Security Manager
From: Brian Gix @ 2011-04-04 22:22 UTC (permalink / raw)
To: Gustavo F. Padovan
Cc: BlueZ development, Vinicius Costa Gomes, Claudio Takahasi
Hi Gustavo,
I (and a few others) are currently doing LE kernel development work off of:
git://gitorious.org/bluetooth-next/for-upstream.git
which is where Vinicius' LE Security Manager resides.
Acceptance of this body of work into bluetooth-next appears to have
stalled out, and I was wondering if you had a sense for when it may
start moving forward again. Are there any outstanding comments lodged
against it? I have looked through the mail reflector, and not seen
anything that should hold it up, beyond perhaps the normal quiet times
prior to pushing bluetooth-next changes up the food chain towards the
official kernel.
Is this what is occurring?
Thanks for your time,
--
Brian Gix
bgix@codeaurora.org
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum
^ permalink raw reply
* Re: [PATCH] Fix check for valid SCO socket before shutdown
From: Johan Hedberg @ 2011-04-05 2:48 UTC (permalink / raw)
To: Daniel Örstadius; +Cc: linux-bluetooth
In-Reply-To: <BANLkTi=ce+qfeS14zX-k0qrt75iGP1d7ig@mail.gmail.com>
Hi Daniel,
On Fri, Apr 01, 2011, Daniel Örstadius wrote:
> To prevent a crash in the event that there is a request to remove
> the audio connection when it has already been disconnected by the
> remote.
>
> Set headset state to connected directly if there is no SCO socket.
> ---
> audio/headset.c | 12 +++++++++---
> 1 files changed, 9 insertions(+), 3 deletions(-)
Pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Add uuidtest binary to gitignore list
From: Johan Hedberg @ 2011-04-05 2:49 UTC (permalink / raw)
To: David Herrmann; +Cc: linux-bluetooth, David Herrmann
In-Reply-To: <1301766760-12063-1-git-send-email-dh.herrmann@gmail.com>
Hi David,
On Sat, Apr 02, 2011, David Herrmann wrote:
> ---
> .gitignore | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 1/3] Fix handling of suspend response
From: Johan Hedberg @ 2011-04-05 2:53 UTC (permalink / raw)
To: Luiz Augusto von Dentz; +Cc: linux-bluetooth
In-Reply-To: <1301907619-6684-1-git-send-email-luiz.dentz@gmail.com>
Hi Luiz,
On Mon, Apr 04, 2011, Luiz Augusto von Dentz wrote:
> finalize_suspend is being called twice when a resume request is queue
> after it or if start fails.
> ---
> audio/a2dp.c | 22 +++++++++++-----------
> 1 files changed, 11 insertions(+), 11 deletions(-)
All three patches have been pushed upstream. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH v3] staging: Add ST-Ericsson CG2900 driver
From: Greg KH @ 2011-04-05 6:08 UTC (permalink / raw)
To: Par-Gunnar Hjalmdahl
Cc: Greg Kroah-Hartman, devel, Linus Walleij, linux-kernel,
linux-bluetooth, Pavan Savoy, Vitaly Wool, Alan Cox,
Arnd Bergmann, Marcel Holtmann, Lukasz Rymanowski, Linus Walleij,
Par-Gunnar Hjalmdahl, Lee Jones, Mathieu Poirier
In-Reply-To: <1301399358-10783-1-git-send-email-par-gunnar.p.hjalmdahl@stericsson.com>
On Tue, Mar 29, 2011 at 01:49:18PM +0200, Par-Gunnar Hjalmdahl wrote:
> +config CG2900_UART
> + tristate "Support CG2900 UART transport"
> + depends on CG2900
> + select BT
> + select BT_HCIUART
No, depend on this, don't have a staging driver select any other config
options, sorry.
Care to fix this up, and your drivers/staging/Kconfig fuzz in the patch
and resend it?
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH 04/10] Bluetooth: Use kthread API in bnep
From: Szymon Janc @ 2011-04-05 7:51 UTC (permalink / raw)
To: Gustavo F. Padovan
Cc: linux-bluetooth@vger.kernel.org,
par-gunnar.p.hjalmdahl@stericsson.com,
henrik.possung@stericsson.com
In-Reply-To: <20110324201226.GG2236@joana>
> Hy Szymon,
Hi,
> * Szymon Janc <szymon.janc@tieto.com> [2011-03-21 14:20:00 +0100]:
>
> > kernel_thread() is a low-level implementation detail and
> > EXPORT_SYMBOL(kernel_thread) is scheduled for removal.
> > Use the <linux/kthread.h> API instead.
>
> Just to be sure. Have you tested the kernel_thread removal patches for bnep
> and hipd?
Sorry for late reply, missed that one..
Yes, I did test both bnep (basic connect-disconnect) and hidp (play around with it
from my mobile). Kernel processes create and terminate fine.
I didn't test cmtp (don't have isdn hw) but change is very similar to rest of patches.
I've noticed that hidp patch doesn't apply anymore to bluetooth-next-2.6 after
merging 2.6.39-rc1. I'll send v2 shortly (only for that one if you're fine with that)
BR,
Szymon Janc
^ permalink raw reply
* RE: [PATCH v3] staging: Add ST-Ericsson CG2900 driver
From: Par-Gunnar HJALMDAHL @ 2011-04-05 8:28 UTC (permalink / raw)
To: Greg KH
Cc: Greg Kroah-Hartman, devel@driverdev.osuosl.org, Linus Walleij,
linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org,
Pavan Savoy, Vitaly Wool, Alan Cox, Arnd Bergmann,
Marcel Holtmann, Lukasz Rymanowski, Linus WALLEIJ,
Par-Gunnar Hjalmdahl, Lee Jones, Mathieu Poirier
In-Reply-To: <20110405060844.GA15065@kroah.com>
> -----Original Message-----
> From: Greg KH [mailto:greg@kroah.com]
> Sent: den 5 april 2011 08:09
> > +config CG2900_UART
> > + tristate "Support CG2900 UART transport"
> > + depends on CG2900
> > + select BT
> > + select BT_HCIUART
>=20
> No, depend on this, don't have a staging driver select any other config
> options, sorry.
>=20
> Care to fix this up, and your drivers/staging/Kconfig fuzz in the patch
> and resend it?
>=20
> thanks,
>=20
> greg k-h
This is code left from the non-staging state. I will update and resend.
Thanks,
P-G
^ permalink raw reply
* RE: [PATCH] Bluetooth: change gfp type in hci_recv_stream_fragment()
From: Zhang Jiejing-B33651 @ 2011-04-05 8:47 UTC (permalink / raw)
To: Gustavo F. Padovan
Cc: suraj@atheros.com, marcel@holtmann.org,
linux-bluetooth@vger.kernel.org
In-Reply-To: <20110404211617.GD2230@joana>
Hi Gustavo,=0A=
=0A=
Yes, you are right, this is a irq context can't use GFP_KERNEL.=0A=
=0A=
But what if it return error like -NOMEM? =0A=
I meet this while debugging hci_ath.c driver.=0A=
this the function call chain in hci_ath.c driver when some data receive.=0A=
=0A=
low_level_uart_driver -> hci_ldisc.c:hci_uart_tty_receive() --> ath_recv()=
--> hci_recv_stream_fragment()=0A=
=0A=
1. If hci_recv_stream_fragment return an error like -NOMEM, the ath_recv() =
will report a error : Frame Reassembly Failed. but still return the count t=
o hci_uart_tty_receive(). hci_uart_tty_receive() will add this count to his=
receive statistics. =0A=
=0A=
2. I think it should do some thing like report an error, let upper level kn=
ow the receive data is got error. =0A=
I guess maybe upper level like rfcomm will check the package's checksum ? =
=0A=
=0A=
This patch is for the #1.=0A=
=0A=
diff --git a/drivers/bluetooth/hci_ath.c b/drivers/bluetooth/hci_ath.c=0A=
index bd34406..caf807e 100644=0A=
--- a/drivers/bluetooth/hci_ath.c=0A=
+++ b/drivers/bluetooth/hci_ath.c=0A=
@@ -201,8 +201,12 @@ static struct sk_buff *ath_dequeue(struct hci_uart *hu=
)=0A=
/* Recv data */=0A=
static int ath_recv(struct hci_uart *hu, void *data, int count)=0A=
{=0A=
- if (hci_recv_stream_fragment(hu->hdev, data, count) < 0)=0A=
+ int ret;=0A=
+ ret =3D hci_recv_stream_fragment(hu->hdev, data, count);=0A=
+ if (ret < 0) {=0A=
BT_ERR("Frame Reassembly Failed");=0A=
+ return ret;=0A=
+ }=0A=
=0A=
return count;=0A=
}=0A=
diff --git a/drivers/bluetooth/hci_ldisc.c b/drivers/bluetooth/hci_ldisc.c=
=0A=
index 48ad2a7..320f718 100644=0A=
--- a/drivers/bluetooth/hci_ldisc.c=0A=
+++ b/drivers/bluetooth/hci_ldisc.c=0A=
@@ -359,6 +359,7 @@ static void hci_uart_tty_wakeup(struct tty_struct *tty)=
=0A=
*/=0A=
static void hci_uart_tty_receive(struct tty_struct *tty, const u8 *data, c=
har *flags, int count)=0A=
{=0A=
+ int ret;=0A=
struct hci_uart *hu =3D (void *)tty->disc_data;=0A=
=0A=
if (!hu || tty !=3D hu->tty)=0A=
@@ -368,8 +369,9 @@ static void hci_uart_tty_receive(struct tty_struct *tty=
, const u8 *data, char *f=0A=
return;=0A=
=0A=
spin_lock(&hu->rx_lock);=0A=
- hu->proto->recv(hu, (void *) data, count);=0A=
- hu->hdev->stat.byte_rx +=3D count;=0A=
+ ret =3D hu->proto->recv(hu, (void *) data, count);=0A=
+ if (ret > 0)=0A=
+ hu->hdev->stat.byte_rx +=3D count;=0A=
spin_unlock(&hu->rx_lock);=0A=
=0A=
tty_unthrottle(tty);=0A=
=0A=
=0A=
________________________________________=0A=
From: Gustavo F. Padovan [pao@profusion.mobi] on behalf of Gustavo F. Padov=
an [padovan@profusion.mobi]=0A=
Sent: Tuesday, April 05, 2011 5:16 AM=0A=
To: Zhang Jiejing-B33651=0A=
Cc: suraj@atheros.com; marcel@holtmann.org; linux-bluetooth@vger.kernel.org=
=0A=
Subject: Re: [PATCH] Bluetooth: change gfp type in hci_recv_stream_fragment=
()=0A=
=0A=
Hi Zhang,=0A=
=0A=
* Zhang Jiejing <jiejing.zhang@freescale.com> [2011-03-31 14:56:56 +0800]:=
=0A=
=0A=
> change gfp type passed to hci_reassembly(), replace GFP_ATOMIC=0A=
> to GFP_KERNEL. Since some HCI_ACLDATA may request 1024+4 bytes=0A=
> some time GFP_ATOMIC will failed to allocation memory during=0A=
> large file FTP transfer in high baud rate.=0A=
>=0A=
> Signed-off-by: Zhang Jiejing <jiejing.zhang@freescale.com>=0A=
> ---=0A=
> net/bluetooth/hci_core.c | 2 +-=0A=
> 1 files changed, 1 insertions(+), 1 deletions(-)=0A=
>=0A=
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c=0A=
> index 9c4541b..22b3ded 100644=0A=
> --- a/net/bluetooth/hci_core.c=0A=
> +++ b/net/bluetooth/hci_core.c=0A=
> @@ -1214,7 +1214,7 @@ int hci_recv_stream_fragment(struct hci_dev *hdev, =
void *data, int count)=0A=
> type =3D bt_cb(skb)->pkt_type;=0A=
>=0A=
> rem =3D hci_reassembly(hdev, type, data,=0A=
> - count, STREAM_REASSEMBLY, GFP_ATOMI=
C);=0A=
> + count, STREAM_REASSEMBLY, GFP_KERNE=
L);=0A=
=0A=
We can't use GFP_KERNEL in a interrupt context, we can't sleep here and=0A=
GFP_ATOMIC guarantees that.=0A=
=0A=
--=0A=
Gustavo F. Padovan=0A=
http://profusion.mobi=0A=
=0A=
^ permalink raw reply related
* Re: [PATCH] Bluetooth: change gfp type in hci_recv_stream_fragment()
From: Suraj Sumangala @ 2011-04-05 12:02 UTC (permalink / raw)
To: Zhang Jiejing-B33651
Cc: Gustavo F. Padovan, Suraj Sumangala, marcel@holtmann.org,
linux-bluetooth@vger.kernel.org
In-Reply-To: <00EDC7B5DB2F5145BEDBC1CE66AD2727166177@039-SN1MPN1-004.039d.mgd.msft.net>
Hi Zhang,
On 4/5/2011 2:17 PM, Zhang Jiejing-B33651 wrote:
> 2. I think it should do some thing like report an error, let upper level know the receive data is got error.
> I guess maybe upper level like rfcomm will check the package's checksum ?
I guess if there is an issue with allocating buffer, the only option
could be just dropping. If we have L2CAP using ERTM mode, it might be
able to recover from the data loss. Otherways, not sure there is anyway
other than disconnecting the link(profile other than A2DP).
Ideally there would be a break in traffic at the protocol level and the
protocol might initiate a graceful disconnection here.
Regards
Suraj
^ permalink raw reply
* Re: [PATCH] kstrtox: convert net/bluetooth/
From: Alexey Dobriyan @ 2011-04-05 12:33 UTC (permalink / raw)
To: Alexey Dobriyan, marcel, linux-bluetooth; +Cc: Gustavo F. Padovan
In-Reply-To: <20110404220002.GF2230@joana>
On Tue, Apr 5, 2011 at 1:00 AM, Gustavo F. Padovan
<padovan@profusion.mobi> wrote:
>> @@ -299,15 +300,13 @@ static ssize_t show_sniff_max_interval(struct device *dev, struct device_attribu
>> static ssize_t store_sniff_max_interval(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
>> {
>> struct hci_dev *hdev = dev_get_drvdata(dev);
>> - unsigned long val;
>> -
>> - if (strict_strtoul(buf, 0, &val) < 0)
>> - return -EINVAL;
>> -
>> - if (val < 0x0002 || val > 0xFFFE || val % 2)
>> - return -EINVAL;
>> + u16 val;
>> + int rv;
>>
>> - if (val < hdev->sniff_min_interval)
>> + rv = kstrtou16(buf, 0, &val);
>> + if (rv < 0)
>> + return rv;
>> + if (val == 0 || val % 2 || val < hdev->sniff_min_interval)
>> return -EINVAL;
>
> Why are you changing other things besides the string conversions?
Because this is not mindless s/foo/bar/g conversion.
> The checks for val should stay the same.
No, they should not. kstrtou16() takes care of [0x0000, 0xFFFF] interval,
then you check for even values, then you have only 0 to ban.
WIth previous checks, say, "val > 0xFFFE" is not necessary,
kstrtou16 + "val % 2" do it.
^ permalink raw reply
* [PATCH] Add attrib_db_clear() to attribute server API
From: Anderson Lizardo @ 2011-04-05 13:36 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
This function allows some external plugin to totally reimplement the
attribute server by replacing all attributes (including the GAP ones).
Note that it is not safe to call this function while there are active
client connections.
---
src/attrib-server.c | 29 +++++++++++++++++++++++++++++
src/attrib-server.h | 1 +
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/src/attrib-server.c b/src/attrib-server.c
index 2e95628..f6bb75b 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -1317,6 +1317,35 @@ int attrib_db_del(uint16_t handle)
return 0;
}
+void attrib_db_clear(void)
+{
+ GSList *l;
+
+ /* FIXME: bad things could happen if there are active connections while
+ * the attribute database is manipulated. Make sure to call this
+ * function only when it is safe, i.e. when there are no active
+ * clients. */
+
+ g_slist_foreach(database, (GFunc) g_free, NULL);
+ g_slist_free(database);
+ database = NULL;
+
+ /* Also remove notifications, indications and client configuration from
+ * clients */
+ for (l = clients; l; l = l->next) {
+ struct gatt_channel *channel = l->data;
+
+ g_slist_free(channel->notify);
+ g_slist_free(channel->indicate);
+ g_slist_foreach(channel->configs, (GFunc) g_free, NULL);
+ g_slist_free(channel->configs);
+
+ channel->notify = NULL;
+ channel->indicate = NULL;
+ channel->configs = NULL;
+ }
+}
+
int attrib_gap_set(uint16_t uuid, const uint8_t *value, int len)
{
uint16_t handle;
diff --git a/src/attrib-server.h b/src/attrib-server.h
index 83484fc..b7a2182 100644
--- a/src/attrib-server.h
+++ b/src/attrib-server.h
@@ -31,6 +31,7 @@ struct attribute *attrib_db_add(uint16_t handle, bt_uuid_t *uuid, int read_reqs,
int attrib_db_update(uint16_t handle, bt_uuid_t *uuid, const uint8_t *value,
int len, struct attribute **attr);
int attrib_db_del(uint16_t handle);
+void attrib_db_clear(void);
int attrib_gap_set(uint16_t uuid, const uint8_t *value, int len);
uint32_t attrib_create_sdp(uint16_t handle, const char *name);
void attrib_free_sdp(uint32_t sdp_handle);
--
1.7.0.4
^ permalink raw reply related
* [PATCH v2] Bluetooth: Use kthread API in hidp
From: Szymon Janc @ 2011-04-05 13:37 UTC (permalink / raw)
To: linux-bluetooth; +Cc: par-gunnar.p.hjalmdahl, henrik.possung, Szymon Janc
In-Reply-To: <201104050951.17932.szymon.janc@tieto.com>
kernel_thread() is a low-level implementation detail and
EXPORT_SYMBOL(kernel_thread) is scheduled for removal.
Use the <linux/kthread.h> API instead.
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
---
net/bluetooth/hidp/core.c | 53 ++++++++++++++++++++------------------------
net/bluetooth/hidp/hidp.h | 2 +-
2 files changed, 25 insertions(+), 30 deletions(-)
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index a1472b7..ae6ebc6 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -37,6 +37,7 @@
#include <linux/init.h>
#include <linux/wait.h>
#include <linux/mutex.h>
+#include <linux/kthread.h>
#include <net/sock.h>
#include <linux/input.h>
@@ -463,8 +464,7 @@ static void hidp_idle_timeout(unsigned long arg)
{
struct hidp_session *session = (struct hidp_session *) arg;
- atomic_inc(&session->terminate);
- hidp_schedule(session);
+ kthread_stop(session->task);
}
static void hidp_set_timer(struct hidp_session *session)
@@ -535,9 +535,7 @@ static void hidp_process_hid_control(struct hidp_session *session,
skb_queue_purge(&session->ctrl_transmit);
skb_queue_purge(&session->intr_transmit);
- /* Kill session thread */
- atomic_inc(&session->terminate);
- hidp_schedule(session);
+ kthread_stop(session->task);
}
}
@@ -696,22 +694,10 @@ static int hidp_session(void *arg)
struct sock *ctrl_sk = session->ctrl_sock->sk;
struct sock *intr_sk = session->intr_sock->sk;
struct sk_buff *skb;
- int vendor = 0x0000, product = 0x0000;
wait_queue_t ctrl_wait, intr_wait;
BT_DBG("session %p", session);
- if (session->input) {
- vendor = session->input->id.vendor;
- product = session->input->id.product;
- }
-
- if (session->hid) {
- vendor = session->hid->vendor;
- product = session->hid->product;
- }
-
- daemonize("khidpd_%04x%04x", vendor, product);
set_user_nice(current, -15);
init_waitqueue_entry(&ctrl_wait, current);
@@ -720,7 +706,7 @@ static int hidp_session(void *arg)
add_wait_queue(sk_sleep(intr_sk), &intr_wait);
session->waiting_for_startup = 0;
wake_up_interruptible(&session->startup_queue);
- while (!atomic_read(&session->terminate)) {
+ while (!kthread_should_stop()) {
set_current_state(TASK_INTERRUPTIBLE);
if (ctrl_sk->sk_state != BT_CONNECTED ||
@@ -968,6 +954,7 @@ fault:
int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock)
{
struct hidp_session *session, *s;
+ int vendor, product;
int err;
BT_DBG("");
@@ -1029,9 +1016,24 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
hidp_set_timer(session);
- err = kernel_thread(hidp_session, session, CLONE_KERNEL);
- if (err < 0)
+ if (session->hid) {
+ vendor = session->hid->vendor;
+ product = session->hid->product;
+ } else if (session->input) {
+ vendor = session->input->id.vendor;
+ product = session->input->id.product;
+ } else {
+ vendor = 0x0000;
+ product = 0x0000;
+ }
+
+ session->task = kthread_run(hidp_session, session, "khidpd_%04x%04x",
+ vendor, product);
+ if (IS_ERR(session->task)) {
+ err = PTR_ERR(session->task);
goto unlink;
+ }
+
while (session->waiting_for_startup) {
wait_event_interruptible(session->startup_queue,
!session->waiting_for_startup);
@@ -1056,8 +1058,7 @@ int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock,
err_add_device:
hid_destroy_device(session->hid);
session->hid = NULL;
- atomic_inc(&session->terminate);
- hidp_schedule(session);
+ kthread_stop(session->task);
unlink:
hidp_del_timer(session);
@@ -1108,13 +1109,7 @@ int hidp_del_connection(struct hidp_conndel_req *req)
skb_queue_purge(&session->ctrl_transmit);
skb_queue_purge(&session->intr_transmit);
- /* Wakeup user-space polling for socket errors */
- session->intr_sock->sk->sk_err = EUNATCH;
- session->ctrl_sock->sk->sk_err = EUNATCH;
-
- /* Kill session thread */
- atomic_inc(&session->terminate);
- hidp_schedule(session);
+ kthread_stop(session->task);
}
} else
err = -ENOENT;
diff --git a/net/bluetooth/hidp/hidp.h b/net/bluetooth/hidp/hidp.h
index b412e71..12822cd 100644
--- a/net/bluetooth/hidp/hidp.h
+++ b/net/bluetooth/hidp/hidp.h
@@ -142,7 +142,7 @@ struct hidp_session {
uint ctrl_mtu;
uint intr_mtu;
- atomic_t terminate;
+ struct task_struct *task;
unsigned char keys[8];
unsigned char leds;
--
1.7.0.4
^ permalink raw reply related
* RE: [PATCH v2] Add sap_disconnect_ind interface for sap-sim drivers
From: Waldemar.Rymarkiewicz @ 2011-04-05 13:38 UTC (permalink / raw)
To: johan.hedberg; +Cc: linux-bluetooth
In-Reply-To: <20110328095557.GA11511@jh-x301>
Hi Johan,
>> The original idea was to have Disconnect(type) method in
>server.c, but
>> finally, in a discussion, we came to the conclusion that the
>immediate
>> disconnect should not be used by user. Driver should handle this if
>> it's needed.
>>
>> So, sap-api.txt stays unchanged, and dummy-driver is changed to be
>> able to pass some of PTS tests.
>
>Ok, sounds fine to me.
Are you going to push upstram this patch ?
Waldek
^ permalink raw reply
* Re: [PATCH 04/10] Bluetooth: Use kthread API in bnep
From: Gustavo F. Padovan @ 2011-04-05 15:39 UTC (permalink / raw)
To: Szymon Janc
Cc: linux-bluetooth@vger.kernel.org,
par-gunnar.p.hjalmdahl@stericsson.com,
henrik.possung@stericsson.com
In-Reply-To: <201104050951.17932.szymon.janc@tieto.com>
Hi Szymon,
* Szymon Janc <szymon.janc@tieto.com> [2011-04-05 09:51:17 +0200]:
> > Hy Szymon,
>
> Hi,
>
> > * Szymon Janc <szymon.janc@tieto.com> [2011-03-21 14:20:00 +0100]:
> >
> > > kernel_thread() is a low-level implementation detail and
> > > EXPORT_SYMBOL(kernel_thread) is scheduled for removal.
> > > Use the <linux/kthread.h> API instead.
> >
> > Just to be sure. Have you tested the kernel_thread removal patches for bnep
> > and hipd?
>
> Sorry for late reply, missed that one..
> Yes, I did test both bnep (basic connect-disconnect) and hidp (play around with it
> from my mobile). Kernel processes create and terminate fine.
Fair enough, I applied the 3 patches. Thanks for fixing this.
>
> I didn't test cmtp (don't have isdn hw) but change is very similar to rest of patches.
No problem, no one should be using this thing these days.
--
Gustavo F. Padovan
http://profusion.mobi
^ permalink raw reply
* Re: [PATCH] kstrtox: convert net/bluetooth/
From: Gustavo F. Padovan @ 2011-04-05 16:38 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: marcel, linux-bluetooth
In-Reply-To: <BANLkTimwBDydVTS2Crcbgiy7sKK+T49pHw@mail.gmail.com>
Hi Alexey,
* Alexey Dobriyan <adobriyan@gmail.com> [2011-04-05 15:33:47 +0300]:
> On Tue, Apr 5, 2011 at 1:00 AM, Gustavo F. Padovan
> <padovan@profusion.mobi> wrote:
>=20
> >> @@ -299,15 +300,13 @@ static ssize_t show_sniff_max_interval(struct de=
vice *dev, struct device_attribu
> >> =A0static ssize_t store_sniff_max_interval(struct device *dev, struct =
device_attribute *attr, const char *buf, size_t count)
> >> =A0{
> >> =A0 =A0 =A0 struct hci_dev *hdev =3D dev_get_drvdata(dev);
> >> - =A0 =A0 unsigned long val;
> >> -
> >> - =A0 =A0 if (strict_strtoul(buf, 0, &val) < 0)
> >> - =A0 =A0 =A0 =A0 =A0 =A0 return -EINVAL;
> >> -
> >> - =A0 =A0 if (val < 0x0002 || val > 0xFFFE || val % 2)
> >> - =A0 =A0 =A0 =A0 =A0 =A0 return -EINVAL;
> >> + =A0 =A0 u16 val;
> >> + =A0 =A0 int rv;
> >>
> >> - =A0 =A0 if (val < hdev->sniff_min_interval)
> >> + =A0 =A0 rv =3D kstrtou16(buf, 0, &val);
> >> + =A0 =A0 if (rv < 0)
> >> + =A0 =A0 =A0 =A0 =A0 =A0 return rv;
> >> + =A0 =A0 if (val =3D=3D 0 || val % 2 || val < hdev->sniff_min_interva=
l)
> >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -EINVAL;
> >
> > Why are you changing other things besides the string conversions?
>=20
> Because this is not mindless s/foo/bar/g conversion.
>=20
> > The checks for val should stay the same.
>=20
> No, they should not. kstrtou16() takes care of [0x0000, 0xFFFF] interval,
> then you check for even values, then you have only 0 to ban.
>=20
> WIth previous checks, say, "val > 0xFFFE" is not necessary,
> kstrtou16 + "val % 2" do it.
Ok, I agree, I didn't noted that at in a first review. Patch is now applied.
Thanks.
--=20
Gustavo F. Padovan
http://profusion.mobi
^ permalink raw reply
* [PATCH] Fix Characteristic read by UUID on gatttool
From: Sheldon Demario @ 2011-04-05 18:37 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Sheldon Demario
The Characteristic read by UUID GATT procedure is not incremental, i.e. it
returns the entire list in a single Read By Type request. Therefore it
should not be called recursively.
---
attrib/gatttool.c | 6 ------
attrib/interactive.c | 6 ------
2 files changed, 0 insertions(+), 12 deletions(-)
diff --git a/attrib/gatttool.c b/attrib/gatttool.c
index 0dfbc04..be91967 100644
--- a/attrib/gatttool.c
+++ b/attrib/gatttool.c
@@ -273,12 +273,6 @@ static void char_read_by_uuid_cb(guint8 status, const guint8 *pdu,
att_data_list_free(list);
- gatt_read_char_by_uuid(char_data->attrib, char_data->start,
- char_data->end, opt_uuid,
- char_read_by_uuid_cb,
- char_data);
-
- return;
done:
g_free(char_data);
g_main_loop_quit(event_loop);
diff --git a/attrib/interactive.c b/attrib/interactive.c
index 3fafb1e..9a55641 100644
--- a/attrib/interactive.c
+++ b/attrib/interactive.c
@@ -315,14 +315,8 @@ static void char_read_by_uuid_cb(guint8 status, const guint8 *pdu,
att_data_list_free(list);
- gatt_read_char_by_uuid(attrib, char_data->start, char_data->end,
- &char_data->uuid, char_read_by_uuid_cb,
- char_data);
-
rl_forced_update_display();
- return;
-
done:
g_free(char_data);
}
--
1.7.1
^ permalink raw reply related
* [PATCH] Fixing characteristic read by uuid
From: Sheldon Demario @ 2011-04-05 18:38 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Sheldon Demario
When the charecteristic to be read was the last one of a given range, it
was not being listed.
---
src/attrib-server.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/attrib-server.c b/src/attrib-server.c
index 2e95628..7ee496e 100644
--- a/src/attrib-server.c
+++ b/src/attrib-server.c
@@ -431,7 +431,7 @@ static uint16_t read_by_type(struct gatt_channel *channel, uint16_t start,
if (a->handle < start)
continue;
- if (a->handle >= end)
+ if (a->handle > end)
break;
if (bt_uuid_cmp(&a->uuid, uuid) != 0)
--
1.7.1
^ permalink raw reply related
* pull request: bluetooth-next-2.6 2011-04-05
From: Gustavo F. Padovan @ 2011-04-06 0:42 UTC (permalink / raw)
To: linville; +Cc: linux-wireless, linux-bluetooth
Hi John,
A bulk of patches to 2.6.39. In this pull request, some more improvements to
HCI Managment Interface from Johan Hedberg, Out of Band Pairing support from
Szymon Janc. The others are API updates (kstrtox and kernel_thread), fixes and
cleanups.
Please pull, thanks!
The following changes since commit 26d59535aa08386b97ece58a27bb16fca4f066db:
mac80211: clean up station cleanup timer (2011-04-04 16:20:07 -0400)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/padovan/bluetooth-next-2.6.git master
Alexey Dobriyan (1):
Bluetooth: convert net/bluetooth/ to kstrtox
Andrei Emeltchenko (2):
Bluetooth: check L2CAP info_rsp ident and state
Bluetooth: delete hanging L2CAP channel
Gustavo F. Padovan (10):
Bluetooth: remove unnecessary function declaration
Bluetooth: Remove unused struct item
Bluetooth: Improve error message on wrong link type
Bluetooth: Remove unused struct l2cap_conn item
Bluetooth: Move bt_accept_enqueue() to outside __l2cap_chan_add
Bluetooth: Fix HCI_RESET command synchronization
Merge branch 'master' of git://git.kernel.org/.../padovan/bluetooth-2.6
Bluetooth: Remove gfp_mask param from hci_reassembly()
Bluetooth: Don't use spin_lock_bh in user context
Bluetooth: Use GFP_KERNEL in user context
Johan Hedberg (7):
Bluetooth: Add define for the maximum name length on HCI level
Bluetooth: mgmt: Add local name information to read_info reply
Bluetooth: mgmt: Add support for setting the local name
Bluetooth: Add local Extended Inquiry Response (EIR) support
Bluetooth: Fix missing hci_dev_lock_bh in user_confirm_reply
Bluetooth: Add mgmt_device_found event
Bluetooth: Add mgmt_remote_name event
Marc-Antoine Perennou (1):
Bluetooth: add support for Apple MacBook Pro 8,2
Suraj Sumangala (1):
Bluetooth: Increment unacked_frames count only the first transmit
Szymon Janc (15):
Bluetooth: Opencode macros in bnep/core.c
Bluetooth: Fix checkpatch errors and some code style issues in bnep
Bluetooth: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
Bluetooth: Fix checkpatch errors, code style issues and typos in hidp
Bluetooth: Do not use assignments in IF conditions
Bluetooth: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
Bluetooth: Fix checkpatch error in cmtp.h
Bluetooth: Rename cmd to param in pending_cmd
Bluetooth: Allow for NULL data in mgmt_pending_add
Bluetooth: Add read_local_oob_data management command
Bluetooth: Add add/remove_remote_oob_data management commands
Bluetooth: Enable support for out of band association model
Bluetooth: Use kthread API in hidp
Bluetooth: Use kthread API in bnep
Bluetooth: Use kthread API in cmtp
Thomas Gleixner (1):
Bluetooth: Fix warning with hci_cmd_timer
Vinicius Costa Gomes (1):
Bluetooth: Fix sending LE data over USB
drivers/bluetooth/btusb.c | 6 +-
include/net/bluetooth/hci.h | 42 +++-
include/net/bluetooth/hci_core.h | 25 ++-
include/net/bluetooth/l2cap.h | 2 -
include/net/bluetooth/mgmt.h | 47 ++++
net/bluetooth/bnep/bnep.h | 148 ++++++------
net/bluetooth/bnep/core.c | 71 +++---
net/bluetooth/bnep/sock.c | 2 +-
net/bluetooth/cmtp/capi.c | 6 +-
net/bluetooth/cmtp/cmtp.h | 11 +-
net/bluetooth/cmtp/core.c | 25 ++-
net/bluetooth/cmtp/sock.c | 2 +-
net/bluetooth/hci_core.c | 89 ++++++-
net/bluetooth/hci_event.c | 99 ++++++--
net/bluetooth/hci_sysfs.c | 40 ++--
net/bluetooth/hidp/core.c | 90 ++++----
net/bluetooth/hidp/hidp.h | 6 +-
net/bluetooth/hidp/sock.c | 7 +-
net/bluetooth/l2cap_core.c | 31 ++-
net/bluetooth/l2cap_sock.c | 5 +-
net/bluetooth/mgmt.c | 518 ++++++++++++++++++++++++++++++++++----
21 files changed, 981 insertions(+), 291 deletions(-)
--
Gustavo F. Padovan
http://profusion.mobi
^ permalink raw reply
* [PATCH] Fix setting of mode after discovery times out.
From: Jaikumar Ganesh @ 2011-04-06 0:44 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Jaikumar Ganesh
When discovery times out, we were not setting the mode appropriately.
Thus, if the adapter is turned off and on, we will get the incorrect mode.
Also add a forward declaration for the introduced circular dependency.
---
src/adapter.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/adapter.c b/src/adapter.c
index c400bfd..014cc0c 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -156,6 +156,8 @@ struct btd_adapter {
static void adapter_set_pairable_timeout(struct btd_adapter *adapter,
guint interval);
+static DBusMessage *set_discoverable(DBusConnection *conn, DBusMessage *msg,
+ gboolean discoverable, void *data);
static int found_device_cmp(const struct remote_dev_info *d1,
const struct remote_dev_info *d2)
@@ -374,7 +376,7 @@ static gboolean discov_timeout_handler(gpointer user_data)
adapter->discov_timeout_id = 0;
- adapter_ops->set_discoverable(adapter->dev_id, FALSE);
+ set_discoverable(NULL, NULL, FALSE, user_data);
return FALSE;
}
--
1.7.3.1
^ permalink raw reply related
* Re: Low Energy Security Manager
From: Gustavo F. Padovan @ 2011-04-06 1:03 UTC (permalink / raw)
To: Brian Gix; +Cc: BlueZ development, Vinicius Costa Gomes, Claudio Takahasi
In-Reply-To: <4D9A44A7.4020204@codeaurora.org>
Hi Brian,
* Brian Gix <bgix@codeaurora.org> [2011-04-04 15:22:31 -0700]:
>
> Hi Gustavo,
>
> I (and a few others) are currently doing LE kernel development work off of:
>
> git://gitorious.org/bluetooth-next/for-upstream.git
>
> which is where Vinicius' LE Security Manager resides.
>
> Acceptance of this body of work into bluetooth-next appears to have
> stalled out, and I was wondering if you had a sense for when it may
> start moving forward again. Are there any outstanding comments lodged
> against it? I have looked through the mail reflector, and not seen
> anything that should hold it up, beyond perhaps the normal quiet times
> prior to pushing bluetooth-next changes up the food chain towards the
> official kernel.
The reason is that Marcel also want to review it and he didn't finished his
review it. So things can still changes. We have to be careful on adding new
stuff like a whole layer. If we do something wrong we will have to support
that for years and could be a bad thing. Once Marcel and me finish the review
I will push everything to bluetooth-next. It shouldn't take so long now.
Regards,
--
Gustavo F. Padovan
http://profusion.mobi
^ permalink raw reply
* Re: Low Energy Security Manager
From: Vinicius Costa Gomes @ 2011-04-06 1:24 UTC (permalink / raw)
To: Brian Gix, BlueZ development, Claudio Takahasi
In-Reply-To: <20110406010355.GB2279@joana>
On 22:03 Tue 05 Apr, Gustavo F. Padovan wrote:
> Hi Brian,
>
> * Brian Gix <bgix@codeaurora.org> [2011-04-04 15:22:31 -0700]:
>
> >
> > Hi Gustavo,
> >
> > I (and a few others) are currently doing LE kernel development work off of:
> >
> > git://gitorious.org/bluetooth-next/for-upstream.git
> >
> > which is where Vinicius' LE Security Manager resides.
> >
> > Acceptance of this body of work into bluetooth-next appears to have
> > stalled out, and I was wondering if you had a sense for when it may
> > start moving forward again. Are there any outstanding comments lodged
> > against it? I have looked through the mail reflector, and not seen
> > anything that should hold it up, beyond perhaps the normal quiet times
> > prior to pushing bluetooth-next changes up the food chain towards the
> > official kernel.
>
> The reason is that Marcel also want to review it and he didn't finished his
> review it. So things can still changes. We have to be careful on adding new
> stuff like a whole layer. If we do something wrong we will have to support
> that for years and could be a bad thing. Once Marcel and me finish the review
> I will push everything to bluetooth-next. It shouldn't take so long now.
As a remimder I will re-send them, so everyone has a chance to take another
look.
>
> Regards,
>
> --
> Gustavo F. Padovan
> http://profusion.mobi
Cheers,
--
Vinicius
^ permalink raw reply
* [bluetooth-next 00/15] SM Just Works Implementation
From: Vinicius Costa Gomes @ 2011-04-06 1:51 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Vinicius Costa Gomes
Hi,
Changes from the previous version:
- fixed a problem when SM was disabled;
- (a little) improved negotiation of pairing parameters;
--
Cheers,
Anderson Briglia (7):
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
Vinicius Costa Gomes (8):
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: Fix initial security level of LE links
Bluetooth: Update the security level when link is encrypted
Bluetooth: Add support for Pairing features exchange
Bluetooth: Add support for SMP timeout
Bluetooth: Add key size checks for SMP
include/net/bluetooth/hci.h | 34 +++
include/net/bluetooth/hci_core.h | 10 +
include/net/bluetooth/l2cap.h | 9 +
include/net/bluetooth/smp.h | 46 ++++
net/bluetooth/Kconfig | 6 +
net/bluetooth/Makefile | 2 +-
net/bluetooth/hci_conn.c | 47 ++++
net/bluetooth/hci_core.c | 22 ++
net/bluetooth/hci_event.c | 69 +++++
net/bluetooth/l2cap_core.c | 137 ++++++----
net/bluetooth/l2cap_sock.c | 16 ++
net/bluetooth/smp.c | 538 ++++++++++++++++++++++++++++++++++++++
12 files changed, 878 insertions(+), 58 deletions(-)
create mode 100644 net/bluetooth/smp.c
--
1.7.4.1
^ permalink raw reply
* [bluetooth-next 01/15] Bluetooth: Implement the first SMP commands
From: Vinicius Costa Gomes @ 2011-04-06 1:51 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Briglia, Vinicius Costa Gomes
In-Reply-To: <1302054716-24534-1-git-send-email-vinicius.gomes@openbossa.org>
From: Anderson Briglia <anderson.briglia@openbossa.org>
These simple commands will allow the SMP procedure to be started
and terminated with a not supported error. This is the first step
toward something useful.
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Signed-off-by: Anderson Briglia <anderson.briglia@openbossa.org>
---
include/net/bluetooth/smp.h | 26 ++++++++
net/bluetooth/Makefile | 2 +-
net/bluetooth/smp.c | 146 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 173 insertions(+), 1 deletions(-)
create mode 100644 net/bluetooth/smp.c
diff --git a/include/net/bluetooth/smp.h b/include/net/bluetooth/smp.h
index 8f2edbf..36bdd6e 100644
--- a/include/net/bluetooth/smp.h
+++ b/include/net/bluetooth/smp.h
@@ -1,3 +1,25 @@
+/*
+ BlueZ - Bluetooth protocol stack for Linux
+ Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2 as
+ published by the Free Software Foundation;
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
+ CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
+ COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
+ SOFTWARE IS DISCLAIMED.
+*/
+
#ifndef __SMP_H
#define __SMP_H
@@ -73,4 +95,8 @@ struct smp_cmd_security_req {
#define SMP_UNSPECIFIED 0x08
#define SMP_REPEATED_ATTEMPTS 0x09
+/* SMP Commands */
+int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level);
+int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb);
+
#endif /* __SMP_H */
diff --git a/net/bluetooth/Makefile b/net/bluetooth/Makefile
index f04fe9a..9b67f3d 100644
--- a/net/bluetooth/Makefile
+++ b/net/bluetooth/Makefile
@@ -9,5 +9,5 @@ obj-$(CONFIG_BT_CMTP) += cmtp/
obj-$(CONFIG_BT_HIDP) += hidp/
bluetooth-y := af_bluetooth.o hci_core.o hci_conn.o hci_event.o mgmt.o hci_sock.o hci_sysfs.o lib.o
-bluetooth-$(CONFIG_BT_L2CAP) += l2cap_core.o l2cap_sock.o
+bluetooth-$(CONFIG_BT_L2CAP) += l2cap_core.o l2cap_sock.o smp.o
bluetooth-$(CONFIG_BT_SCO) += sco.o
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
new file mode 100644
index 0000000..8b67a56
--- /dev/null
+++ b/net/bluetooth/smp.c
@@ -0,0 +1,146 @@
+/*
+ BlueZ - Bluetooth protocol stack for Linux
+ Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2 as
+ published by the Free Software Foundation;
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
+ CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
+ COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
+ SOFTWARE IS DISCLAIMED.
+*/
+
+#include <net/bluetooth/bluetooth.h>
+#include <net/bluetooth/hci_core.h>
+#include <net/bluetooth/l2cap.h>
+#include <net/bluetooth/smp.h>
+
+static struct sk_buff *smp_build_cmd(struct l2cap_conn *conn, u8 code,
+ u16 dlen, void *data)
+{
+ struct sk_buff *skb;
+ struct l2cap_hdr *lh;
+ int len;
+
+ len = L2CAP_HDR_SIZE + sizeof(code) + dlen;
+
+ if (len > conn->mtu)
+ return NULL;
+
+ skb = bt_skb_alloc(len, GFP_ATOMIC);
+ if (!skb)
+ return NULL;
+
+ lh = (struct l2cap_hdr *) skb_put(skb, L2CAP_HDR_SIZE);
+ lh->len = cpu_to_le16(sizeof(code) + dlen);
+ lh->cid = cpu_to_le16(L2CAP_CID_SMP);
+
+ memcpy(skb_put(skb, sizeof(code)), &code, sizeof(code));
+
+ memcpy(skb_put(skb, dlen), data, dlen);
+
+ return skb;
+}
+
+static void smp_send_cmd(struct l2cap_conn *conn, u8 code, u16 len, void *data)
+{
+ struct sk_buff *skb = smp_build_cmd(conn, code, len, data);
+
+ BT_DBG("code 0x%2.2x", code);
+
+ if (!skb)
+ return;
+
+ hci_send_acl(conn->hcon, skb, 0);
+}
+
+int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level)
+{
+ __u8 authreq;
+
+ BT_DBG("conn %p hcon %p level 0x%2.2x", conn, conn->hcon, sec_level);
+
+ switch (sec_level) {
+ case BT_SECURITY_MEDIUM:
+ /* Encrypted, no MITM protection */
+ authreq = HCI_AT_NO_BONDING_MITM;
+ break;
+
+ case BT_SECURITY_HIGH:
+ /* Bonding, MITM protection */
+ authreq = HCI_AT_GENERAL_BONDING_MITM;
+ break;
+
+ case BT_SECURITY_LOW:
+ default:
+ return 1;
+ }
+
+ if (conn->hcon->link_mode & HCI_LM_MASTER) {
+ struct smp_cmd_pairing cp;
+ cp.io_capability = 0x00;
+ cp.oob_flag = 0x00;
+ cp.max_key_size = 16;
+ cp.init_key_dist = 0x00;
+ cp.resp_key_dist = 0x00;
+ cp.auth_req = authreq;
+ smp_send_cmd(conn, SMP_CMD_PAIRING_REQ, sizeof(cp), &cp);
+ } else {
+ struct smp_cmd_security_req cp;
+ cp.auth_req = authreq;
+ smp_send_cmd(conn, SMP_CMD_SECURITY_REQ, sizeof(cp), &cp);
+ }
+
+ return 0;
+}
+
+int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
+{
+ __u8 code = skb->data[0];
+ __u8 reason;
+ int err = 0;
+
+ skb_pull(skb, sizeof(code));
+
+ switch (code) {
+ case SMP_CMD_PAIRING_REQ:
+ reason = SMP_PAIRING_NOTSUPP;
+ smp_send_cmd(conn, SMP_CMD_PAIRING_FAIL, sizeof(reason),
+ &reason);
+ err = -EOPNOTSUPP;
+ break;
+
+ case SMP_CMD_PAIRING_FAIL:
+ break;
+
+ case SMP_CMD_PAIRING_RSP:
+ case SMP_CMD_PAIRING_CONFIRM:
+ case SMP_CMD_PAIRING_RANDOM:
+ case SMP_CMD_ENCRYPT_INFO:
+ case SMP_CMD_MASTER_IDENT:
+ case SMP_CMD_IDENT_INFO:
+ case SMP_CMD_IDENT_ADDR_INFO:
+ case SMP_CMD_SIGN_INFO:
+ case SMP_CMD_SECURITY_REQ:
+ default:
+ BT_DBG("Unknown command code 0x%2.2x", code);
+
+ reason = SMP_CMD_NOTSUPP;
+ smp_send_cmd(conn, SMP_CMD_PAIRING_FAIL, sizeof(reason),
+ &reason);
+ err = -EOPNOTSUPP;
+ }
+
+ kfree_skb(skb);
+ return err;
+}
--
1.7.4.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox