Message ID | 20210406181927.313769-5-marcel@holtmann.org (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Luiz Von Dentz |
Headers | show |
Series | [v2,1/5] Bluetooth: Add support for reading AOSP vendor capabilities | expand |
Hi Marcel, I love your patch! Yet something to improve: [auto build test ERROR on bluetooth-next/master] [also build test ERROR on linus/master v5.12-rc6 next-20210406] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Marcel-Holtmann/Bluetooth-Add-support-for-reading-AOSP-vendor-capabilities/20210407-022147 base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master config: x86_64-rhel-8.3 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/6fee37bd0831e9e9ea756e496e3403b0a18a0c98 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Marcel-Holtmann/Bluetooth-Add-support-for-reading-AOSP-vendor-capabilities/20210407-022147 git checkout 6fee37bd0831e9e9ea756e496e3403b0a18a0c98 # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): net/bluetooth/mgmt.c: In function 'read_controller_cap': >> net/bluetooth/mgmt.c:3737:41: error: 'struct hci_dev' has no member named 'msft_curve_validity' 3737 | if ((hdev->commands[41] & 0x08) || hdev->msft_curve_validity) | ^~ vim +3737 net/bluetooth/mgmt.c 3715 3716 static int read_controller_cap(struct sock *sk, struct hci_dev *hdev, 3717 void *data, u16 data_len) 3718 { 3719 char buf[20]; 3720 struct mgmt_rp_read_controller_cap *rp = (void *)buf; 3721 u16 cap_len = 0; 3722 u8 flags = 0; 3723 u8 tx_power_range[2]; 3724 3725 bt_dev_dbg(hdev, "sock %p", sk); 3726 3727 memset(&buf, 0, sizeof(buf)); 3728 3729 hci_dev_lock(hdev); 3730 3731 /* When the Read Simple Pairing Options command is supported, then 3732 * the remote public key validation is supported. 3733 * 3734 * Alternatively, when Microsoft extensions are available, they can 3735 * indicate support for public key validation as well. 3736 */ > 3737 if ((hdev->commands[41] & 0x08) || hdev->msft_curve_validity) 3738 flags |= 0x01; /* Remote public key validation (BR/EDR) */ 3739 3740 flags |= 0x02; /* Remote public key validation (LE) */ 3741 3742 /* When the Read Encryption Key Size command is supported, then the 3743 * encryption key size is enforced. 3744 */ 3745 if (hdev->commands[20] & 0x10) 3746 flags |= 0x04; /* Encryption key size enforcement (BR/EDR) */ 3747 3748 flags |= 0x08; /* Encryption key size enforcement (LE) */ 3749 3750 cap_len = eir_append_data(rp->cap, cap_len, MGMT_CAP_SEC_FLAGS, 3751 &flags, 1); 3752 3753 /* When the Read Simple Pairing Options command is supported, then 3754 * also max encryption key size information is provided. 3755 */ 3756 if (hdev->commands[41] & 0x08) 3757 cap_len = eir_append_le16(rp->cap, cap_len, 3758 MGMT_CAP_MAX_ENC_KEY_SIZE, 3759 hdev->max_enc_key_size); 3760 3761 cap_len = eir_append_le16(rp->cap, cap_len, 3762 MGMT_CAP_SMP_MAX_ENC_KEY_SIZE, 3763 SMP_MAX_ENC_KEY_SIZE); 3764 3765 /* Append the min/max LE tx power parameters if we were able to fetch 3766 * it from the controller 3767 */ 3768 if (hdev->commands[38] & 0x80) { 3769 memcpy(&tx_power_range[0], &hdev->min_le_tx_power, 1); 3770 memcpy(&tx_power_range[1], &hdev->max_le_tx_power, 1); 3771 cap_len = eir_append_data(rp->cap, cap_len, MGMT_CAP_LE_TX_PWR, 3772 tx_power_range, 2); 3773 } 3774 3775 rp->cap_len = cpu_to_le16(cap_len); 3776 3777 hci_dev_unlock(hdev); 3778 3779 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_READ_CONTROLLER_CAP, 0, 3780 rp, sizeof(*rp) + cap_len); 3781 } 3782 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Marcel, I love your patch! Yet something to improve: [auto build test ERROR on bluetooth-next/master] [also build test ERROR on linus/master v5.12-rc6 next-20210406] [cannot apply to bluetooth/master] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Marcel-Holtmann/Bluetooth-Add-support-for-reading-AOSP-vendor-capabilities/20210407-022147 base: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master config: x86_64-rhel-8.3-kselftests (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/6fee37bd0831e9e9ea756e496e3403b0a18a0c98 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Marcel-Holtmann/Bluetooth-Add-support-for-reading-AOSP-vendor-capabilities/20210407-022147 git checkout 6fee37bd0831e9e9ea756e496e3403b0a18a0c98 # save the attached .config to linux build tree make W=1 ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): net/bluetooth/mgmt.c: In function 'read_controller_cap': >> net/bluetooth/mgmt.c:3737:41: error: 'struct hci_dev' has no member named 'msft_curve_validity' 3737 | if ((hdev->commands[41] & 0x08) || hdev->msft_curve_validity) | ^~ vim +3737 net/bluetooth/mgmt.c 3715 3716 static int read_controller_cap(struct sock *sk, struct hci_dev *hdev, 3717 void *data, u16 data_len) 3718 { 3719 char buf[20]; 3720 struct mgmt_rp_read_controller_cap *rp = (void *)buf; 3721 u16 cap_len = 0; 3722 u8 flags = 0; 3723 u8 tx_power_range[2]; 3724 3725 bt_dev_dbg(hdev, "sock %p", sk); 3726 3727 memset(&buf, 0, sizeof(buf)); 3728 3729 hci_dev_lock(hdev); 3730 3731 /* When the Read Simple Pairing Options command is supported, then 3732 * the remote public key validation is supported. 3733 * 3734 * Alternatively, when Microsoft extensions are available, they can 3735 * indicate support for public key validation as well. 3736 */ > 3737 if ((hdev->commands[41] & 0x08) || hdev->msft_curve_validity) 3738 flags |= 0x01; /* Remote public key validation (BR/EDR) */ 3739 3740 flags |= 0x02; /* Remote public key validation (LE) */ 3741 3742 /* When the Read Encryption Key Size command is supported, then the 3743 * encryption key size is enforced. 3744 */ 3745 if (hdev->commands[20] & 0x10) 3746 flags |= 0x04; /* Encryption key size enforcement (BR/EDR) */ 3747 3748 flags |= 0x08; /* Encryption key size enforcement (LE) */ 3749 3750 cap_len = eir_append_data(rp->cap, cap_len, MGMT_CAP_SEC_FLAGS, 3751 &flags, 1); 3752 3753 /* When the Read Simple Pairing Options command is supported, then 3754 * also max encryption key size information is provided. 3755 */ 3756 if (hdev->commands[41] & 0x08) 3757 cap_len = eir_append_le16(rp->cap, cap_len, 3758 MGMT_CAP_MAX_ENC_KEY_SIZE, 3759 hdev->max_enc_key_size); 3760 3761 cap_len = eir_append_le16(rp->cap, cap_len, 3762 MGMT_CAP_SMP_MAX_ENC_KEY_SIZE, 3763 SMP_MAX_ENC_KEY_SIZE); 3764 3765 /* Append the min/max LE tx power parameters if we were able to fetch 3766 * it from the controller 3767 */ 3768 if (hdev->commands[38] & 0x80) { 3769 memcpy(&tx_power_range[0], &hdev->min_le_tx_power, 1); 3770 memcpy(&tx_power_range[1], &hdev->max_le_tx_power, 1); 3771 cap_len = eir_append_data(rp->cap, cap_len, MGMT_CAP_LE_TX_PWR, 3772 tx_power_range, 2); 3773 } 3774 3775 rp->cap_len = cpu_to_le16(cap_len); 3776 3777 hci_dev_unlock(hdev); 3778 3779 return mgmt_cmd_complete(sk, hdev->id, MGMT_OP_READ_CONTROLLER_CAP, 0, 3780 rp, sizeof(*rp) + cap_len); 3781 } 3782 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 58f7eada26fd..c73ac52af186 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -584,6 +584,7 @@ struct hci_dev { #if IS_ENABLED(CONFIG_BT_MSFTEXT) __u16 msft_opcode; void *msft_data; + bool msft_curve_validity; #endif #if IS_ENABLED(CONFIG_BT_AOSPEXT) diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 59f8016c4866..288c1445c232 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -3730,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) || hdev->msft_curve_validity) flags |= 0x01; /* Remote public key validation (BR/EDR) */ flags |= 0x02; /* Remote public key validation (LE) */ diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c index 47b104f318e9..b1970467a868 100644 --- a/net/bluetooth/msft.c +++ b/net/bluetooth/msft.c @@ -142,6 +142,9 @@ static bool read_supported_features(struct hci_dev *hdev, msft->evt_prefix_len = rp->evt_prefix_len; msft->features = __le64_to_cpu(rp->features); + if (msft->features & MSFT_FEATURE_MASK_CURVE_VALIDITY) + hdev->msft_curve_validity = true; + kfree_skb(skb); return true;
Some controllers don't support the Simple Pairing Options feature that can indicate the support for P-192 and P-256 public key validation. However they might support the Microsoft vendor extension that can indicate the validiation capability as well. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> --- include/net/bluetooth/hci_core.h | 1 + net/bluetooth/mgmt.c | 5 ++++- net/bluetooth/msft.c | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-)