linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt <mwtaylor@gmail.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: Error setting UUIDs discovery filter on big endian systems
Date: Wed, 6 Mar 2019 13:48:31 +0000	[thread overview]
Message-ID: <a90cfd1f-95aa-6b2e-9aab-66d5b950bb59@gmail.com> (raw)
In-Reply-To: <CABBYNZL2F3JaZA27azU8Z2OZ_4CsnosT+Scsrhn9YAA-3i=iaQ@mail.gmail.com>

On 06/03/2019 11:10, Luiz Augusto von Dentz wrote:
> Looks like the kernel is indeed assuming the length is in LE:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git/tree/net/bluetooth/mgmt.c#n3958

Thanks for pointing me to this line, removing the __le16_to_cpu() does 
seem to fix the UUIDs filter scanning on my big endian hardware, I'm not 
sure why it is needed, perhaps removing it would break LE hardware or 
some other case but I would imagine __le16_to_cpu() would do nothing in 
the LE case anyway. I have made this patch to my kernel (4.9) that seems 
to be all is needed for me to fix the issue (no changes to bluez):

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index ba24f61..507d996 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3599,7 +3599,7 @@ static int start_service_discovery(struct sock 
*sk, struct hci_dev *hdev,
          goto failed;
      }

-    uuid_count = __le16_to_cpu(cp->uuid_count);
+    uuid_count = cp->uuid_count;
      if (uuid_count > max_uuid_count) {
          BT_ERR("service_discovery: too big uuid_count value %u",
                 uuid_count);



  reply	other threads:[~2019-03-06 13:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-03 13:56 Error setting UUIDs discovery filter on big endian systems Matt
2018-12-04 19:53 ` Luiz Augusto von Dentz
2018-12-05  0:27   ` Matt
2019-03-05 18:02     ` Matt
2019-03-06 11:10       ` Luiz Augusto von Dentz
2019-03-06 13:48         ` Matt [this message]
2019-03-06 14:14           ` Luiz Augusto von Dentz
2019-03-06 15:14             ` Matt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a90cfd1f-95aa-6b2e-9aab-66d5b950bb59@gmail.com \
    --to=mwtaylor@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).