Bluetooth: Fix advertising instance validity check for flags
authorSzymon Janc <szymon.janc@codecoup.pl>
Sun, 18 Sep 2016 10:50:06 +0000 (12:50 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 19 Sep 2016 18:19:34 +0000 (20:19 +0200)
Flags are not allowed in Scan Response.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/mgmt.c

index c96b0adc4971ac2d5da71ea1e1b054cfcc8ffd3a..2758c6a4425c8bed4ad7d8732d3978e65cddd839 100644 (file)
@@ -6065,7 +6065,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))