RE: [PATCH v2] Bluetooth: btqca: sequential validation

From: Sai Teja Aluvala (Temp) (QUIC)
Date: Wed Dec 15 2021 - 06:28:24 EST




-----Original Message-----
From: Marcel Holtmann <marcel@xxxxxxxxxxxx>
Sent: Thursday, December 9, 2021 4:15 PM
To: Sai Teja Aluvala (Temp) (QUIC) <quic_saluvala@xxxxxxxxxxx>
Cc: Johan Hedberg <johan.hedberg@xxxxxxxxx>; Matthias Kaehlcke <mka@xxxxxxxxxxxx>; Linux Kernel Mailing List <linux-kernel@xxxxxxxxxxxxxxx>; linux-bluetooth <linux-bluetooth@xxxxxxxxxxxxxxx>; Hemant Gupta (QUIC) <quic_hemantg@xxxxxxxxxxx>; MSM <linux-arm-msm@xxxxxxxxxxxxxxx>; quic_bgodavar <quic_bgodavar@xxxxxxxxxxx>; Rocky Liao <rjliao@xxxxxxxxxxxxxx>; hbandi@xxxxxxxxxxxxxx; Abhishek Pandit-Subedi <abhishekpandit@xxxxxxxxxxxx>; Miao-chen Chou <mcchou@xxxxxxxxxxxx>; PANICKER HARISH (Temp) (QUIC) <quic_pharish@xxxxxxxxxxx>
Subject: Re: [PATCH v2] Bluetooth: btqca: sequential validation

Hi Sai,

> This change will have sequential validation support & patch config
> command is added
>
> Signed-off-by: Sai Teja Aluvala <quic_saluvala@xxxxxxxxxxx>
> ---
> drivers/bluetooth/btqca.c | 50
> +++++++++++++++++++++++++++++++++++++++++++++++
> drivers/bluetooth/btqca.h | 2 ++
> 2 files changed, 52 insertions(+)
>
> diff --git a/drivers/bluetooth/btqca.c b/drivers/bluetooth/btqca.c
> index be04d74..633a24c 100644
> --- a/drivers/bluetooth/btqca.c
> +++ b/drivers/bluetooth/btqca.c
> @@ -141,6 +141,53 @@ static int qca_read_fw_build_info(struct hci_dev *hdev)
> return err;
> }
>
> +static int qca_send_patch_config_cmd(struct hci_dev *hdev) {
> + struct sk_buff *skb;
> + int err = 0;
> + u8 cmd[] = {EDL_PATCH_CONFIG_CMD, 0x01, 0, 0, 0};

is there are reason not to address review comments?
[Sai] : I will address in next patch

const u8 cmd[] = { EDL_PATCH_CONFIG_CMD, 0x01, 0, 0, 0 };

> + u8 rlen = 0x02;
> + struct edl_event_hdr *edl;
> + u8 rtype = EDL_PATCH_CONFIG_CMD;

I missed these two and must have assumed there are used somewhere, rlen and rtype are a waste to be declared.
[Sai] : I will delete rlen in next patch.

> +
> + bt_dev_dbg(hdev, "QCA Patch config");
> +
> + skb = __hci_cmd_sync_ev(hdev, EDL_PATCH_CMD_OPCODE, sizeof(cmd),
> + cmd, HCI_EV_VENDOR, HCI_INIT_TIMEOUT);
> + if (IS_ERR(skb)) {
> + err = PTR_ERR(skb);
> + bt_dev_err(hdev, "Sending QCA Patch config failed (%d)", err);
> + return err;
> + }
> +
> + if (skb->len != rlen) {

if (skb->len != 2) {

> + bt_dev_err(hdev, "QCA Patch config cmd size mismatch len %d", skb->len);
> + err = -EILSEQ;
> + goto out;
> + }
> +
> + edl = (struct edl_event_hdr *)(skb->data);
> + if (!edl) {
> + bt_dev_err(hdev, "QCA Patch config with no header");
> + err = -EILSEQ;
> + goto out;
> + }
> +
> + if (edl->cresp != EDL_PATCH_CONFIG_RES_EVT || edl->rtype != rtype) {

edl->rtype != EDL_PATCH_CONFIG_CMD) {

[Sai] : I will update in next patch.


> + bt_dev_err(hdev, "QCA Wrong packet received %d %d", edl->cresp,
> + edl->rtype);
> + err = -EIO;
> + goto out;
> + }
> +
> +out:
> + kfree(skb);
> + if (err)
> + bt_dev_err(hdev, "QCA Patch config cmd failed (%d)", err);
> +
> + return err;
> +}
> +

Regards

Marcel