Merge tag 'block-5.13-2021-05-09' of git://git.kernel.dk/linux-block
[linux-2.6-microblaze.git] / net / bluetooth / mgmt.c
index 74971b4..f9be7f9 100644 (file)
@@ -40,7 +40,7 @@
 #include "msft.h"
 
 #define MGMT_VERSION   1
-#define MGMT_REVISION  19
+#define MGMT_REVISION  20
 
 static const u16 mgmt_commands[] = {
        MGMT_OP_READ_INDEX_LIST,
@@ -108,6 +108,8 @@ static const u16 mgmt_commands[] = {
        MGMT_OP_START_LIMITED_DISCOVERY,
        MGMT_OP_READ_EXT_INFO,
        MGMT_OP_SET_APPEARANCE,
+       MGMT_OP_GET_PHY_CONFIGURATION,
+       MGMT_OP_SET_PHY_CONFIGURATION,
        MGMT_OP_SET_BLOCKED_KEYS,
        MGMT_OP_SET_WIDEBAND_SPEECH,
        MGMT_OP_READ_CONTROLLER_CAP,
@@ -166,6 +168,8 @@ static const u16 mgmt_events[] = {
        MGMT_EV_PHY_CONFIGURATION_CHANGED,
        MGMT_EV_EXP_FEATURE_CHANGED,
        MGMT_EV_DEVICE_FLAGS_CHANGED,
+       MGMT_EV_ADV_MONITOR_ADDED,
+       MGMT_EV_ADV_MONITOR_REMOVED,
        MGMT_EV_CONTROLLER_SUSPEND,
        MGMT_EV_CONTROLLER_RESUME,
 };
@@ -196,8 +200,6 @@ static const u16 mgmt_untrusted_events[] = {
        MGMT_EV_EXT_INDEX_REMOVED,
        MGMT_EV_EXT_INFO_CHANGED,
        MGMT_EV_EXP_FEATURE_CHANGED,
-       MGMT_EV_ADV_MONITOR_ADDED,
-       MGMT_EV_ADV_MONITOR_REMOVED,
 };
 
 #define CACHE_TIMEOUT  msecs_to_jiffies(2 * 1000)
@@ -3728,8 +3730,11 @@ static int read_controller_cap(struct sock *sk, struct hci_dev *hdev,
 
        /* When the Read Simple Pairing Options command is supported, then
         * the remote public key validation is supported.
+        *
+        * Alternatively, when Microsoft extensions are available, they can
+        * indicate support for public key validation as well.
         */
-       if (hdev->commands[41] & 0x08)
+       if ((hdev->commands[41] & 0x08) || msft_curve_validity(hdev))
                flags |= 0x01;  /* Remote public key validation (BR/EDR) */
 
        flags |= 0x02;          /* Remote public key validation (LE) */
@@ -3982,7 +3987,7 @@ static int set_exp_feature(struct sock *sk, struct hci_dev *hdev,
                if (hdev_is_powered(hdev))
                        return mgmt_cmd_status(sk, hdev->id,
                                               MGMT_OP_SET_EXP_FEATURE,
-                                              MGMT_STATUS_NOT_POWERED);
+                                              MGMT_STATUS_REJECTED);
 
                /* Parameters are limited to a single octet */
                if (data_len != MGMT_SET_EXP_FEATURE_SIZE + 1)
@@ -7432,6 +7437,7 @@ static u32 get_supported_adv_flags(struct hci_dev *hdev)
        flags |= MGMT_ADV_PARAM_TIMEOUT;
        flags |= MGMT_ADV_PARAM_INTERVALS;
        flags |= MGMT_ADV_PARAM_TX_POWER;
+       flags |= MGMT_ADV_PARAM_SCAN_RSP;
 
        /* In extended adv TX_POWER returned from Set Adv Param
         * will be always valid.
@@ -7475,7 +7481,7 @@ static int read_adv_features(struct sock *sk, struct hci_dev *hdev,
         * advertising.
         */
        if (hci_dev_test_flag(hdev, HCI_ENABLE_LL_PRIVACY))
-               return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING,
+               return mgmt_cmd_status(sk, hdev->id, MGMT_OP_READ_ADV_FEATURES,
                                       MGMT_STATUS_NOT_SUPPORTED);
 
        hci_dev_lock(hdev);
@@ -7976,7 +7982,6 @@ static int add_ext_adv_params(struct sock *sk, struct hci_dev *hdev,
                goto unlock;
        }
 
-       hdev->cur_adv_instance = cp->instance;
        /* Submit request for advertising params if ext adv available */
        if (ext_adv_capable(hdev)) {
                hci_req_init(&req, hdev);