lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABBYNZKiyj9G6O9HZFh2PArD2uebh5cEG_xFzWXrNZ_dD=pudQ@mail.gmail.com>
Date: Thu, 13 Nov 2025 10:54:40 -0500
From: Luiz Augusto von Dentz <luiz.dentz@...il.com>
To: Gongwei Li <13875017792@....com>
Cc: Marcel Holtmann <marcel@...tmann.org>, Johan Hedberg <johan.hedberg@...il.com>, 
	linux-bluetooth@...r.kernel.org, netdev@...r.kernel.org, 
	linux-kernel@...r.kernel.org, Gongwei Li <ligongwei@...inos.cn>, 
	Paul Menzel <pmenzel@...gen.mpg.de>
Subject: Re: [PATCH v2 2/2] Bluetooth: Process Read Remote Version evt

Hi,

On Thu, Nov 13, 2025 at 1:12 AM Gongwei Li <13875017792@....com> wrote:
>
> From: Gongwei Li <ligongwei@...inos.cn>
>
> Add processing for HCI Process Read Remote Version event.
> Used to query the lmp version of remote devices.
>
> Signed-off-by: Gongwei Li <ligongwei@...inos.cn>
> Reviewed-by: Paul Menzel <pmenzel@...gen.mpg.de>
> ---
> v1->v2: Add bt_dev_dbg to print remote_ver
>  include/net/bluetooth/hci_core.h |  1 +
>  net/bluetooth/hci_event.c        | 25 +++++++++++++++++++++++++
>  net/bluetooth/mgmt.c             |  5 +++++
>  3 files changed, 31 insertions(+)
>
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index 9efdefed3..424349b74 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -750,6 +750,7 @@ struct hci_conn {
>
>         __u8            remote_cap;
>         __u8            remote_auth;
> +       __u8            remote_ver;
>
>         unsigned int    sent;
>
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 7c4ca14f1..762a3e58b 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -3738,6 +3738,28 @@ static void hci_remote_features_evt(struct hci_dev *hdev, void *data,
>         hci_dev_unlock(hdev);
>  }
>
> +static void hci_remote_version_evt(struct hci_dev *hdev, void *data,
> +                                  struct sk_buff *skb)
> +{
> +       struct hci_ev_remote_version *ev = (void *)skb->data;
> +       struct hci_conn *conn;
> +
> +       bt_dev_dbg(hdev, "");
> +
> +       hci_dev_lock(hdev);
> +
> +       conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
> +       if (!conn)
> +               goto unlock;
> +
> +       conn->remote_ver = ev->lmp_ver;
> +
> +       bt_dev_dbg(hdev, "remote_ver 0x%2.2x", conn->remote_ver);
> +
> +unlock:
> +       hci_dev_unlock(hdev);
> +}
> +
>  static inline void handle_cmd_cnt_and_timer(struct hci_dev *hdev, u8 ncmd)
>  {
>         cancel_delayed_work(&hdev->cmd_timer);
> @@ -7523,6 +7545,9 @@ static const struct hci_ev {
>         /* [0x0b = HCI_EV_REMOTE_FEATURES] */
>         HCI_EV(HCI_EV_REMOTE_FEATURES, hci_remote_features_evt,
>                sizeof(struct hci_ev_remote_features)),
> +       /* [0x0c = HCI_EV_REMOTE_VERSION] */
> +       HCI_EV(HCI_EV_REMOTE_VERSION, hci_remote_version_evt,
> +              sizeof(struct hci_ev_remote_version)),
>         /* [0x0e = HCI_EV_CMD_COMPLETE] */
>         HCI_EV_REQ_VL(HCI_EV_CMD_COMPLETE, hci_cmd_complete_evt,
>                       sizeof(struct hci_ev_cmd_complete), HCI_MAX_EVENT_SIZE),
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index c11cdef42..9b8add6a2 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -9745,6 +9745,9 @@ void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,
>  {
>         struct sk_buff *skb;
>         struct mgmt_ev_device_connected *ev;
> +       struct hci_cp_read_remote_version cp;
> +
> +       memset(&cp, 0, sizeof(cp));
>         u16 eir_len = 0;
>         u32 flags = 0;
>
> @@ -9791,6 +9794,8 @@ void mgmt_device_connected(struct hci_dev *hdev, struct hci_conn *conn,
>         ev->eir_len = cpu_to_le16(eir_len);
>
>         mgmt_event_skb(skb, NULL);
> +
> +       hci_send_cmd(hdev, HCI_OP_READ_REMOTE_VERSION, sizeof(cp), &cp);

This should probably be made into hci_event.c and write a helper in
hci_sync.c that properly queues the command instead of using the
hci_send_cmd to send the command directly.

>  }
>
>  static void unpair_device_rsp(struct mgmt_pending_cmd *cmd, void *data)
> --
> 2.25.1
>


-- 
Luiz Augusto von Dentz

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ