linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Szymon Janc <szymon.janc@codecoup.pl>
To: linux-bluetooth@vger.kernel.org
Cc: Szymon Janc <szymon.janc@codecoup.pl>
Subject: [PATCH v2 5/6] Bluetooth: Fix advertising instance validity check for flags
Date: Sun, 18 Sep 2016 12:50:06 +0200	[thread overview]
Message-ID: <1474195807-12310-5-git-send-email-szymon.janc@codecoup.pl> (raw)
In-Reply-To: <1474195807-12310-1-git-send-email-szymon.janc@codecoup.pl>

Flags are not allowed in Scan Response.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
---
 net/bluetooth/mgmt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index cdc88f4..61e8153 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -6067,7 +6067,8 @@ static bool tlv_data_is_valid(u32 adv_flags, u8 *data, u8 len, bool is_adv_data)
 	for (i = 0, cur_len = 0; i < len; i += (cur_len + 1)) {
 		cur_len = data[i];
 
-		if (data[i + 1] == EIR_FLAGS && flags_managed(adv_flags))
+		if (data[i + 1] == EIR_FLAGS &&
+		    (!is_adv_data || flags_managed(adv_flags)))
 			return false;
 
 		if (data[i + 1] == EIR_TX_POWER && tx_power_managed(adv_flags))
-- 
2.7.4


  parent reply	other threads:[~2016-09-18 10:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-18 10:50 [PATCH v2 1/6] Bluetooth: Add support for local name in scan rsp Szymon Janc
2016-09-18 10:50 ` [PATCH v2 2/6] Bluetooth: Add support for appearance " Szymon Janc
2016-09-18 10:50 ` [PATCH v2 3/6] Bluetooth: Remove unused parameter from tlv_data_is_valid function Szymon Janc
2016-09-18 10:50 ` [PATCH v2 4/6] Bluetooth: Unify advertising instance flags check Szymon Janc
2016-09-18 10:50 ` Szymon Janc [this message]
2016-09-18 10:50 ` [PATCH v2 6/6] Bluetooth: Increment management interface revision Szymon Janc
2016-09-18 14:28 ` [PATCH v2 1/6] Bluetooth: Add support for local name in scan rsp Marcel Holtmann
2016-09-18 18:02   ` Szymon Janc
2016-09-18 19:17     ` Marcel Holtmann
2016-09-19  6:29 ` Marcel Holtmann

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=1474195807-12310-5-git-send-email-szymon.janc@codecoup.pl \
    --to=szymon.janc@codecoup.pl \
    --cc=linux-bluetooth@vger.kernel.org \
    /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).