* Re: [PATCH] Bluetooth: Don't copy L2CAP LE signalling to raw sockets
From: Johan Hedberg @ 2013-10-03 7:10 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380783109-37739-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> The L2CAP raw sockets are only used for BR/EDR signalling. Packets
> on LE links should not be forwarded there.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/l2cap_core.c | 2 --
> 1 file changed, 2 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Bluetooth: Fix switch statement order for L2CAP fixed channels
From: Johan Hedberg @ 2013-10-03 7:09 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380782814-35670-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> The switch statement for the various L2CAP fixed channel handlers
> is not really ordered.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/l2cap_core.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH] Bluetooth: Allow changing device class when BR/EDR is disabled
From: Johan Hedberg @ 2013-10-03 7:06 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380782249-29597-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> Changing the device class when BR/EDR is disabled has no visible
> effect for remote devices. However to simplify the logic allow it
> as long as the controller supports BR/EDR operations.
>
> If it is not allowed, then the overall logic becomes rather
> complicated since the class of device values would need clearing
> or restoring when BR/EDR setting changes.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* [PATCH] Bluetooth: L2CAP connectionless channels are only valid for BR/EDR
From: Marcel Holtmann @ 2013-10-03 7:03 UTC (permalink / raw)
To: linux-bluetooth
When receiving connectionless packets on a LE connection, just drop
the packet. There is no concept of connectionless channels for LE.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index eee18f3..583517e1 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -6403,8 +6403,12 @@ done:
static void l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm,
struct sk_buff *skb)
{
+ struct hci_conn *hcon = conn->hcon;
struct l2cap_chan *chan;
+ if (hcon->type != ACL_LINK)
+ goto drop;
+
chan = l2cap_global_chan_by_psm(0, psm, conn->src, conn->dst);
if (!chan)
goto drop;
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] Regression fix revert: "Bluetooth: Add missing reset_resume dev_pm_ops"
From: Hans de Goede @ 2013-10-03 7:00 UTC (permalink / raw)
To: Marcel Holtmann, Gustavo Padovan
Cc: USB list, linux-bluetooth, Shuah Khan, Gustavo Padovan, stable
In-Reply-To: <508150F6-D142-4406-8CC9-57DDE754F391@holtmann.org>
Hi,
On 10/03/2013 05:39 AM, Marcel Holtmann wrote:
> Hi Gustavo,
>
>>> Many btusb devices have 2 modes, a hid mode and a bluetooth hci mode. These
>>> devices default to hid mode for BIOS use. This means that after having been
>>> reset they will revert to HID mode, and are no longer usable as a HCI.
>>>
>>> Therefor it is a very bad idea to just blindly make reset_resume point to
>>> the regular resume handler. Note that the btusb driver has no clue how to
>>> switch these devices from hid to hci mode, this is done in userspace through
>>> udev rules, so the proper way to deal with this is to not have a reset-resume
>>> handler and instead let the usb-system re-enumerate the device, and re-run
>>> the udev rules.
>>>
>>> I must also note, that the commit message for the commit causing this
>>> problem has a very weak motivation for the change:
>>>
>>> "Add missing reset_resume dev_pm_ops. Missing reset_resume results in the
>>> following message after power management device test. This change sets
>>> reset_resume to btusb_resume().
>>>
>>> [ 2506.936134] btusb 1-1.5:1.0: no reset_resume for driver btusb?
>>> [ 2506.936137] btusb 1-1.5:1.1: no reset_resume for driver btusb?"
>>>
>>> Making a change solely to silence a warning while also changing important
>>> behavior (normal resume handling versus re-enumeration) requires a commit
>>> message with a proper explanation why it is safe to do so, which clearly lacks
>>> here, and unsurprisingly it turns out to not be safe to make this change.
>>>
>>> Reverting the commit in question fixes bt no longer working on my Dell
>>> E6430 after a suspend/resume, and I believe it likely also fixes the
>>> following bugs:
>>> https://bugzilla.redhat.com/show_bug.cgi?id=988481
>>> https://bugzilla.redhat.com/show_bug.cgi?id=1010649
>>> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1213239
>>>
>>> This reverts commit 502f769662978a2fe99d0caed5e53e3006107381.
>>>
>>> Cc: Shuah Khan <shuah.kh@samsung.com>
>>> Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>>> Cc: stable@vger.kernel.org
>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>> ---
>>> drivers/bluetooth/btusb.c | 1 -
>>> 1 file changed, 1 deletion(-)
>>
>> Patch has been applied to bluetooth.git. Thanks.
>
> why? Because we have one broken Dell Bluetooth dongle.
Well for one, because we have a no regressions policy.
For another because the original patch does not actually fix anything
(according to the original commit message), it just silences a warning
(with a way too big hammer).
> Do we actually know how this affects other chips.
In the mean time I have confirmation that the reset_resume patch also
breaks intel hci's (embedded in their wlan cards, 8087:07da) after
suspend/resume, and that reverting it also fixes this. To be precise
I've confirmation that downgrading to 3.10 which lacks this patch fixes
the intel hci issues, see:
https://bugzilla.redhat.com/show_bug.cgi?id=988481
> The dell HID Proxy thing has always been special case and that is Dell's fault.
And the Logitech HID proxy, and various devices with broadcom chips ...
> Look at the extra code that we have in hid2hci tool and its udev rules for Dell hardware. Is anybody actually willing to investigate this one properly.
If people really want a reset_resume handler, then a lot more works need
to be done then just making reset_resume point to the current resume handler.
reset_resume gets called when on resume the usb subsys sees that the device
has lost power, iow the device has had a hard reset, and all device state is
gone. The current btusb resume handler was never written with the assumption
that all device state is gone. All it does is resubmit a bunch of urbs, it
does not restore any device state, therefor it is unsuitable as a
reset_resume handler.
Regards,
Hans
^ permalink raw reply
* [PATCH] Bluetooth: SMP packets are only valid on LE connections
From: Marcel Holtmann @ 2013-10-03 7:00 UTC (permalink / raw)
To: linux-bluetooth
When receiving SMP packets on a BR/EDR connection, then just drop
the packet and do not try to process it.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/smp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index b5562ab..6e049497 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -847,10 +847,16 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
{
+ struct hci_conn *hcon = conn->hcon;
__u8 code = skb->data[0];
__u8 reason;
int err = 0;
+ if (hcon->type != LE_LINK) {
+ kfree_skb(skb);
+ return -ENOTSUPP;
+ }
+
if (!test_bit(HCI_LE_ENABLED, &conn->hcon->hdev->dev_flags)) {
err = -ENOTSUPP;
reason = SMP_PAIRING_NOTSUPP;
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH bluez v2 1/2] plugin: handle ENOSYS as not-supported
From: Johan Hedberg @ 2013-10-03 6:56 UTC (permalink / raw)
To: David Herrmann; +Cc: linux-bluetooth, Marcel Holtmann
In-Reply-To: <1380729451-2266-1-git-send-email-dh.herrmann@gmail.com>
Hi David,
On Wed, Oct 02, 2013, David Herrmann wrote:
> Allow plugins to return -ENOSYS during registration and handle it as
> "not-supported" error. It makes the error messages slightly more useful in
> case kernel-support is missing for a particular subsystem.
> ---
> src/plugin.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
Both patches have been applied after a couple of minor tweaks: remove
one of the three logs in the bnep failure case (we don't need that many)
and restrict scope of the err variable in plugin.c.
Johan
^ permalink raw reply
* [PATCH] Bluetooth: Don't copy L2CAP LE signalling to raw sockets
From: Marcel Holtmann @ 2013-10-03 6:51 UTC (permalink / raw)
To: linux-bluetooth
The L2CAP raw sockets are only used for BR/EDR signalling. Packets
on LE links should not be forwarded there.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 0661ca6..65c5371 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5327,8 +5327,6 @@ static inline void l2cap_le_sig_channel(struct l2cap_conn *conn,
struct l2cap_cmd_hdr cmd;
int err;
- l2cap_raw_recv(conn, skb);
-
if (hcon->type != LE_LINK)
goto drop;
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Fix switch statement order for L2CAP fixed channels
From: Marcel Holtmann @ 2013-10-03 6:46 UTC (permalink / raw)
To: linux-bluetooth
The switch statement for the various L2CAP fixed channel handlers
is not really ordered.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/l2cap_core.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 814563d..0661ca6 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -6466,9 +6466,6 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb)
BT_DBG("len %d, cid 0x%4.4x", len, cid);
switch (cid) {
- case L2CAP_CID_LE_SIGNALING:
- l2cap_le_sig_channel(conn, skb);
- break;
case L2CAP_CID_SIGNALING:
l2cap_sig_channel(conn, skb);
break;
@@ -6483,6 +6480,10 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb)
l2cap_att_channel(conn, skb);
break;
+ case L2CAP_CID_LE_SIGNALING:
+ l2cap_le_sig_channel(conn, skb);
+ break;
+
case L2CAP_CID_SMP:
if (smp_sig_channel(conn, skb))
l2cap_conn_del(conn->hcon, EACCES);
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Allow changing device class when BR/EDR is disabled
From: Marcel Holtmann @ 2013-10-03 6:37 UTC (permalink / raw)
To: linux-bluetooth
Changing the device class when BR/EDR is disabled has no visible
effect for remote devices. However to simplify the logic allow it
as long as the controller supports BR/EDR operations.
If it is not allowed, then the overall logic becomes rather
complicated since the class of device values would need clearing
or restoring when BR/EDR setting changes.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 4ce0f11..16125ff9 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1757,7 +1757,7 @@ static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data,
BT_DBG("request for %s", hdev->name);
- if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags))
+ if (!lmp_bredr_capable(hdev))
return cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS,
MGMT_STATUS_NOT_SUPPORTED);
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] Bluetooth: Allow setting static address even if LE is disabled
From: Johan Hedberg @ 2013-10-03 6:35 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380777032-23598-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> Setting the static address does not depend on LE beeing enabled. It
> only depends on a controller with LE support.
>
> When depending on LE enabled this command becomes really complicated
> since in case LE gets disabled, it would be required to clear the
> static address and also its random address representation inside
> the controller. With future support for private addresses such
> complex setup should be avoided.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH v2] Bluetooth: Restrict SSP setting changes to BR/EDR enabled controllers
From: Johan Hedberg @ 2013-10-03 6:34 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380774712-13370-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> Only when BR/EDR is supported and enabled, allow changing of the SSP
> setting. Just checking if the hardware supports SSP is not enough
> since it might be the case that BR/EDR is disabled.
>
> In the case that BR/EDR is disabled, but SSP supported by the
> controller the not supported error message is now returned.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 2/2] Bluetooth: Restrict loading of long term keys to LE capable controllers
From: Johan Hedberg @ 2013-10-03 6:34 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380773768-12958-2-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> Loading long term keys into a BR/EDR only controller make no sense.
> The kernel would never use any of these keys. So instead of allowing
> userspace to waste memory, reject such operation with a not supported
> error message.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 6 ++++++
> 1 file changed, 6 insertions(+)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* Re: [PATCH 1/2] Bluetooth: Restrict loading of link keys to BR/EDR capable controllers
From: Johan Hedberg @ 2013-10-03 6:34 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380773768-12958-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
On Wed, Oct 02, 2013, Marcel Holtmann wrote:
> Loading link keys into a LE only controller make no sense. The kernel
> would never use any of these keys. So instead of allowing userspace
> to waste memory, reject such operation with a not supported error
> message.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 6 ++++++
> 1 file changed, 6 insertions(+)
Applied to bluetooth-next. Thanks.
Johan
^ permalink raw reply
* [PATCH] Bluetooth: Allow setting static address even if LE is disabled
From: Marcel Holtmann @ 2013-10-03 5:10 UTC (permalink / raw)
To: linux-bluetooth
Setting the static address does not depend on LE beeing enabled. It
only depends on a controller with LE support.
When depending on LE enabled this command becomes really complicated
since in case LE gets disabled, it would be required to clear the
static address and also its random address representation inside
the controller. With future support for private addresses such
complex setup should be avoided.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 5c44e30..a336027 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3293,15 +3293,13 @@ static int set_static_address(struct sock *sk, struct hci_dev *hdev,
void *data, u16 len)
{
struct mgmt_cp_set_static_address *cp = data;
- u8 status;
int err;
BT_DBG("%s", hdev->name);
- status = mgmt_le_support(hdev);
- if (status)
+ if (!lmp_le_capable(hdev))
return cmd_status(sk, hdev->id, MGMT_OP_SET_STATIC_ADDRESS,
- status);
+ MGMT_STATUS_NOT_SUPPORTED);
if (hdev_is_powered(hdev))
return cmd_status(sk, hdev->id, MGMT_OP_SET_STATIC_ADDRESS,
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Clear class of device when BR/EDR is disabled
From: Marcel Holtmann @ 2013-10-03 4:53 UTC (permalink / raw)
To: linux-bluetooth
Since it is possible to disable BR/EDR on dual-mode controllers, some
extra care needs to be taken for the class of device value. When BR/EDR
is disabled, the value should be set to its default. And properly
restored in case BR/EDR get re-enabled later on.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 9dbf185..5c44e30 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -642,9 +642,15 @@ static void update_class(struct hci_request *req)
if (test_bit(HCI_SERVICE_CACHE, &hdev->dev_flags))
return;
- cod[0] = hdev->minor_class;
- cod[1] = hdev->major_class;
- cod[2] = get_service_classes(hdev);
+ if (test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) {
+ cod[0] = hdev->minor_class;
+ cod[1] = hdev->major_class;
+ cod[2] = get_service_classes(hdev);
+ } else {
+ cod[0] = 0x00;
+ cod[1] = 0x00;
+ cod[2] = 0x00;
+ }
if (memcmp(cod, hdev->dev_class, 3) == 0)
return;
@@ -3523,12 +3529,16 @@ static int set_bredr(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
}
/* We need to flip the bit already here so that hci_update_ad
- * generates the correct flags.
+ * generates the correct flags and update_class sets the correct
+ * class of device information.
*/
set_bit(HCI_BREDR_ENABLED, &hdev->dev_flags);
hci_req_init(&req, hdev);
+
+ update_class(&req);
hci_update_ad(&req);
+
err = hci_req_run(&req, set_bredr_complete);
if (err < 0)
mgmt_pending_remove(cmd);
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Reject device class changes when BR/EDR is not available
From: Marcel Holtmann @ 2013-10-03 4:39 UTC (permalink / raw)
To: linux-bluetooth
On LE only controllers or dual mode controllers with BR/EDR disabled,
it makes no sense to allow programming of the minor and major class
values. In these cases, just reject the operation.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index e93d19a..9dbf185 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1753,13 +1753,14 @@ static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data,
struct mgmt_cp_set_dev_class *cp = data;
struct pending_cmd *cmd;
struct hci_request req;
+ u8 status;
int err;
BT_DBG("request for %s", hdev->name);
- if (!test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags))
- return cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS,
- MGMT_STATUS_NOT_SUPPORTED);
+ status = mgmt_bredr_support(hdev);
+ if (status)
+ return cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS, status);
hci_dev_lock(hdev);
--
1.8.3.1
^ permalink raw reply related
* [PATCH v2] Bluetooth: Restrict SSP setting changes to BR/EDR enabled controllers
From: Marcel Holtmann @ 2013-10-03 4:31 UTC (permalink / raw)
To: linux-bluetooth
Only when BR/EDR is supported and enabled, allow changing of the SSP
setting. Just checking if the hardware supports SSP is not enough
since it might be the case that BR/EDR is disabled.
In the case that BR/EDR is disabled, but SSP supported by the
controller the not supported error message is now returned.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 03fca4c..e93d19a 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1296,11 +1296,15 @@ static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
{
struct mgmt_mode *cp = data;
struct pending_cmd *cmd;
- u8 val;
+ u8 val, status;
int err;
BT_DBG("request for %s", hdev->name);
+ status = mgmt_bredr_support(hdev);
+ if (status)
+ return cmd_status(sk, hdev->id, MGMT_OP_SET_SSP, status);
+
if (!lmp_ssp_capable(hdev))
return cmd_status(sk, hdev->id, MGMT_OP_SET_SSP,
MGMT_STATUS_NOT_SUPPORTED);
--
1.8.3.1
^ permalink raw reply related
* [PATCH] Bluetooth: Restrict SSP setting changes to BR/EDR enabled controllers
From: Marcel Holtmann @ 2013-10-03 4:29 UTC (permalink / raw)
To: linux-bluetooth
Only when BR/EDR is supported and enabled, allow changing of the SSP
setting. Just checking if the hardware supports SSP is not enough
since it might be the case that BR/EDR is disabled.
In the case that BR/EDR is disabled, but SSP supported by the
controller the not supported error message is now returned.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 03fca4c..d15a184 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1296,11 +1296,16 @@ static int set_ssp(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
{
struct mgmt_mode *cp = data;
struct pending_cmd *cmd;
- u8 val;
+ u8 val, status;
int err;
BT_DBG("request for %s", hdev->name);
+ status = mgmt_bredr_support(hdev);
+ if (status)
+ return cmd_status(sk, hdev->id, MGMT_OP_SET_SSP,
+ status);
+
if (!lmp_ssp_capable(hdev))
return cmd_status(sk, hdev->id, MGMT_OP_SET_SSP,
MGMT_STATUS_NOT_SUPPORTED);
--
1.8.3.1
^ permalink raw reply related
* [PATCH 2/2] Bluetooth: Restrict loading of long term keys to LE capable controllers
From: Marcel Holtmann @ 2013-10-03 4:16 UTC (permalink / raw)
To: linux-bluetooth
Loading long term keys into a BR/EDR only controller make no sense.
The kernel would never use any of these keys. So instead of allowing
userspace to waste memory, reject such operation with a not supported
error message.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 273ea8f..03fca4c 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3551,6 +3551,12 @@ static int load_long_term_keys(struct sock *sk, struct hci_dev *hdev,
u16 key_count, expected_len;
int i, err;
+ BT_DBG("request for %s", hdev->name);
+
+ if (!lmp_le_capable(hdev))
+ return cmd_status(sk, hdev->id, MGMT_OP_LOAD_LONG_TERM_KEYS,
+ MGMT_STATUS_NOT_SUPPORTED);
+
key_count = __le16_to_cpu(cp->key_count);
expected_len = sizeof(*cp) + key_count *
--
1.8.3.1
^ permalink raw reply related
* [PATCH 1/2] Bluetooth: Restrict loading of link keys to BR/EDR capable controllers
From: Marcel Holtmann @ 2013-10-03 4:16 UTC (permalink / raw)
To: linux-bluetooth
Loading link keys into a LE only controller make no sense. The kernel
would never use any of these keys. So instead of allowing userspace
to waste memory, reject such operation with a not supported error
message.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 3b3ed05..273ea8f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1821,6 +1821,12 @@ static int load_link_keys(struct sock *sk, struct hci_dev *hdev, void *data,
u16 key_count, expected_len;
int i;
+ BT_DBG("request for %s", hdev->name);
+
+ if (!lmp_bredr_capable(hdev))
+ return cmd_status(sk, hdev->id, MGMT_OP_LOAD_LINK_KEYS,
+ MGMT_STATUS_NOT_SUPPORTED);
+
key_count = __le16_to_cpu(cp->key_count);
expected_len = sizeof(*cp) + key_count *
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH] Regression fix revert: "Bluetooth: Add missing reset_resume dev_pm_ops"
From: Marcel Holtmann @ 2013-10-03 3:39 UTC (permalink / raw)
To: Gustavo Padovan
Cc: Hans de Goede, USB list, linux-bluetooth, Shuah Khan,
Gustavo Padovan, stable
In-Reply-To: <20131002190248.GB3130@joana>
Hi Gustavo,
>> Many btusb devices have 2 modes, a hid mode and a bluetooth hci mode. These
>> devices default to hid mode for BIOS use. This means that after having been
>> reset they will revert to HID mode, and are no longer usable as a HCI.
>>
>> Therefor it is a very bad idea to just blindly make reset_resume point to
>> the regular resume handler. Note that the btusb driver has no clue how to
>> switch these devices from hid to hci mode, this is done in userspace through
>> udev rules, so the proper way to deal with this is to not have a reset-resume
>> handler and instead let the usb-system re-enumerate the device, and re-run
>> the udev rules.
>>
>> I must also note, that the commit message for the commit causing this
>> problem has a very weak motivation for the change:
>>
>> "Add missing reset_resume dev_pm_ops. Missing reset_resume results in the
>> following message after power management device test. This change sets
>> reset_resume to btusb_resume().
>>
>> [ 2506.936134] btusb 1-1.5:1.0: no reset_resume for driver btusb?
>> [ 2506.936137] btusb 1-1.5:1.1: no reset_resume for driver btusb?"
>>
>> Making a change solely to silence a warning while also changing important
>> behavior (normal resume handling versus re-enumeration) requires a commit
>> message with a proper explanation why it is safe to do so, which clearly lacks
>> here, and unsurprisingly it turns out to not be safe to make this change.
>>
>> Reverting the commit in question fixes bt no longer working on my Dell
>> E6430 after a suspend/resume, and I believe it likely also fixes the
>> following bugs:
>> https://bugzilla.redhat.com/show_bug.cgi?id=988481
>> https://bugzilla.redhat.com/show_bug.cgi?id=1010649
>> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1213239
>>
>> This reverts commit 502f769662978a2fe99d0caed5e53e3006107381.
>>
>> Cc: Shuah Khan <shuah.kh@samsung.com>
>> Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> drivers/bluetooth/btusb.c | 1 -
>> 1 file changed, 1 deletion(-)
>
> Patch has been applied to bluetooth.git. Thanks.
why? Because we have one broken Dell Bluetooth dongle. Do we actually know how this affects other chips. The dell HID Proxy thing has always been special case and that is Dell's fault. Look at the extra code that we have in hid2hci tool and its udev rules for Dell hardware. Is anybody actually willing to investigate this one properly.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH] hid2hci: fix regression in /dev format after moving away from libusb
From: Marcel Holtmann @ 2013-10-03 3:37 UTC (permalink / raw)
To: Giovanni Campagna; +Cc: linux-bluetooth
In-Reply-To: <1380729616-26519-1-git-send-email-scampa.giovanni@gmail.com>
Hi Giovanni,
> The paths under /dev, in the default udev configuration, are formatted
> with two leading zeros, but the number obtained from sysfs don't have
> them, so we must convert them to integers and reformat them.
>
> Signed-off-by: Giovanni Campagna <scampa.giovanni@gmail.com>
no signed-off for userspace patches. We only do that for kernel patches.
> ---
> tools/hid2hci.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/tools/hid2hci.c b/tools/hid2hci.c
> index bb8a521..76d0b5a 100644
> --- a/tools/hid2hci.c
> +++ b/tools/hid2hci.c
> @@ -221,18 +221,21 @@ static int usb_switch_dell(int fd, enum mode mode)
> static int find_device(struct udev_device *udev_dev)
> {
> char path[PATH_MAX];
> - const char *busnum, *devnum;
> + const char *busnum_s, *devnum_s;
Use the suffix _str to make clear what it is.
> + int busnum, devnum;
> int fd;
>
> - busnum = udev_device_get_sysattr_value(udev_dev, "busnum");
> - if (!busnum)
> + busnum_s = udev_device_get_sysattr_value(udev_dev, "busnum");
> + if (!busnum_s)
> return -1;
> + busnum = strtol(busnum_s, NULL, 10);
>
> - devnum = udev_device_get_sysattr_value(udev_dev, "devnum");
> - if (!devnum)
> + devnum_s = udev_device_get_sysattr_value(udev_dev, "devnum");
> + if (!devnum_s)
> return -1;
> + devnum = strtol(devnum_s, NULL, 10);
>
> - snprintf(path, sizeof(path), "/dev/bus/usb/%s/%s", busnum, devnum);
> + snprintf(path, sizeof(path), "/dev/bus/usb/%03d/%03d", busnum, devnum);
Regards
Marcel
^ permalink raw reply
* Re: [PATCH] Bluetooth: Fix memory leak with L2CAP signal channels
From: Gustavo Padovan @ 2013-10-02 20:22 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
In-Reply-To: <1380727701-44925-1-git-send-email-marcel@holtmann.org>
Hi Marcel,
2013-10-02 Marcel Holtmann <marcel@holtmann.org>:
> The wrong type of L2CAP signalling packets on the wrong type of
> either BR/EDR or LE links need to be dropped. When that happens
> the packet is dropped, but the memory not freed. So actually
> free the memory as well.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/l2cap_core.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Patch has been applied to bluetooth-next. Thanks.
Gustavo
^ permalink raw reply
* Re: [PATCH] Regression fix revert: "Bluetooth: Add missing reset_resume dev_pm_ops"
From: Gustavo Padovan @ 2013-10-02 19:02 UTC (permalink / raw)
To: Hans de Goede
Cc: USB list, linux-bluetooth, Shuah Khan, Gustavo Padovan, stable
In-Reply-To: <1380374739-11581-1-git-send-email-hdegoede@redhat.com>
Hi Hans,
2013-09-28 Hans de Goede <hdegoede@redhat.com>:
> Many btusb devices have 2 modes, a hid mode and a bluetooth hci mode. These
> devices default to hid mode for BIOS use. This means that after having been
> reset they will revert to HID mode, and are no longer usable as a HCI.
>
> Therefor it is a very bad idea to just blindly make reset_resume point to
> the regular resume handler. Note that the btusb driver has no clue how to
> switch these devices from hid to hci mode, this is done in userspace through
> udev rules, so the proper way to deal with this is to not have a reset-resume
> handler and instead let the usb-system re-enumerate the device, and re-run
> the udev rules.
>
> I must also note, that the commit message for the commit causing this
> problem has a very weak motivation for the change:
>
> "Add missing reset_resume dev_pm_ops. Missing reset_resume results in the
> following message after power management device test. This change sets
> reset_resume to btusb_resume().
>
> [ 2506.936134] btusb 1-1.5:1.0: no reset_resume for driver btusb?
> [ 2506.936137] btusb 1-1.5:1.1: no reset_resume for driver btusb?"
>
> Making a change solely to silence a warning while also changing important
> behavior (normal resume handling versus re-enumeration) requires a commit
> message with a proper explanation why it is safe to do so, which clearly lacks
> here, and unsurprisingly it turns out to not be safe to make this change.
>
> Reverting the commit in question fixes bt no longer working on my Dell
> E6430 after a suspend/resume, and I believe it likely also fixes the
> following bugs:
> https://bugzilla.redhat.com/show_bug.cgi?id=988481
> https://bugzilla.redhat.com/show_bug.cgi?id=1010649
> https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1213239
>
> This reverts commit 502f769662978a2fe99d0caed5e53e3006107381.
>
> Cc: Shuah Khan <shuah.kh@samsung.com>
> Cc: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> Cc: stable@vger.kernel.org
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/bluetooth/btusb.c | 1 -
> 1 file changed, 1 deletion(-)
Patch has been applied to bluetooth.git. Thanks.
Gustavo
^ permalink raw reply
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