From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH] Bluetooth: MGMT: Fix Set PHY Configuration command
Date: Tue, 6 Sep 2022 14:24:21 -0700 [thread overview]
Message-ID: <20220906212421.2810556-1-luiz.dentz@gmail.com> (raw)
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
The command shall accept any subset that is considered configurable but
instead it was only accepting the exact match causing errors such as:
[mgmt]# phy
Supported phys: BR1M1SLOT BR1M3SLOT BR1M5SLOT EDR2M1SLOT EDR2M3SLOT
EDR2M5SLOT EDR3M1SLOT EDR3M3SLOT EDR3M5SLOT LE1MTX LE1MRX LE2MTX
LE2MRX LECODEDTX LECODEDRX
Configurable phys: BR1M3SLOT BR1M5SLOT EDR2M1SLOT EDR2M3SLOT EDR2M5SLOT
EDR3M1SLOT EDR3M3SLOT EDR3M5SLOT LE2MTX LE2MRX LECODEDTX LECODEDRX
Selected phys: BR1M1SLOT BR1M3SLOT BR1M5SLOT EDR2M1SLOT EDR2M3SLOT
EDR2M5SLOT EDR3M1SLOT EDR3M3SLOT EDR3M5SLOT LE1MTX LE1MRX
[mgmt]# phy BR1M3SLOT BR1M5SLOT EDR2M1SLOT EDR2M3SLOT EDR2M5SLOT
EDR3M1SLOT EDR3M3SLOT EDR3M5SLOT LE2MTX LE2MRX
Could not set PHY Configuration with status 0x0d (Invalid Parameters)
Fixes: 0314f2867fa0 ("Bluetooth: Implement Set PHY Confguration command")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
---
net/bluetooth/mgmt.c | 11 ++---------
1 file changed, 2 insertions(+), 9 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 4c421ebac669..9627528ed35f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -4049,7 +4049,7 @@ static int set_phy_configuration(struct sock *sk, struct hci_dev *hdev,
{
struct mgmt_cp_set_phy_configuration *cp = data;
struct mgmt_pending_cmd *cmd;
- u32 selected_phys, configurable_phys, supported_phys, unconfigure_phys;
+ u32 selected_phys, configurable_phys, supported_phys;
u16 pkt_type = (HCI_DH1 | HCI_DM1);
bool changed = false;
int err;
@@ -4060,14 +4060,7 @@ static int set_phy_configuration(struct sock *sk, struct hci_dev *hdev,
supported_phys = get_supported_phys(hdev);
selected_phys = __le32_to_cpu(cp->selected_phys);
- if (selected_phys & ~supported_phys)
- return mgmt_cmd_status(sk, hdev->id,
- MGMT_OP_SET_PHY_CONFIGURATION,
- MGMT_STATUS_INVALID_PARAMS);
-
- unconfigure_phys = supported_phys & ~configurable_phys;
-
- if ((selected_phys & unconfigure_phys) != unconfigure_phys)
+ if (selected_phys & ~configurable_phys)
return mgmt_cmd_status(sk, hdev->id,
MGMT_OP_SET_PHY_CONFIGURATION,
MGMT_STATUS_INVALID_PARAMS);
--
2.37.2
next reply other threads:[~2022-09-06 21:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-06 21:24 Luiz Augusto von Dentz [this message]
2022-09-06 23:30 ` [PATCH] Bluetooth: MGMT: Fix Set PHY Configuration command kernel test robot
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=20220906212421.2810556-1-luiz.dentz@gmail.com \
--to=luiz.dentz@gmail.com \
--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