linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Marcel Holtmann <marcel@holtmann.org>
Cc: "linux-bluetooth@vger.kernel.org" <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH v2 1/4] Bluetooth: Only allow setting msft_opcode at setup stage
Date: Wed, 13 Oct 2021 14:10:26 -0700	[thread overview]
Message-ID: <CABBYNZL6qAMb94Qs1ekmuhm4_u2YB_CAMeUMfHKpDipPxma1eQ@mail.gmail.com> (raw)
In-Reply-To: <3AF15FB4-3BE9-4758-9782-C1935A0F8B3D@holtmann.org>

Hi Marcel,

On Tue, Oct 12, 2021 at 11:35 PM Marcel Holtmann <marcel@holtmann.org> wrote:
>
> Hi Luiz,
>
> > The msft_opcode shall only be changed while at the setup stage otherwise
> > it can possible cause problems where different opcodes are used while
> > running.
> >
> > Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
> > ---
> > v2: Fix typos: s/extention/extension/g
> >
> > include/net/bluetooth/hci_core.h | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> > index dd8840e70e25..eb5d4ea88c3a 100644
> > --- a/include/net/bluetooth/hci_core.h
> > +++ b/include/net/bluetooth/hci_core.h
> > @@ -1272,11 +1272,15 @@ int hci_recv_diag(struct hci_dev *hdev, struct sk_buff *skb);
> > __printf(2, 3) void hci_set_hw_info(struct hci_dev *hdev, const char *fmt, ...);
> > __printf(2, 3) void hci_set_fw_info(struct hci_dev *hdev, const char *fmt, ...);
> >
> > -static inline void hci_set_msft_opcode(struct hci_dev *hdev, __u16 opcode)
> > +static inline int hci_set_msft_opcode(struct hci_dev *hdev, __u16 opcode)
> > {
> > +     if (!hci_dev_test_flag(hdev, HCI_SETUP))
> > +             return -EPERM;
> > +
> > #if IS_ENABLED(CONFIG_BT_MSFTEXT)
> >       hdev->msft_opcode = opcode;
> > #endif
> > +     return 0;
> > }
>
> this is also not going to work since some driver might set it in their probe() routine before calling hci_register_dev.

Shall we allow that though? Perhaps we should be checking for HCI_RUNNING then?

-- 
Luiz Augusto von Dentz

      reply	other threads:[~2021-10-13 21:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-13  0:30 Luiz Augusto von Dentz
2021-10-13  0:30 ` [PATCH v2 2/4] Bluetooth: Only allow setting AOSP capable " Luiz Augusto von Dentz
2021-10-13  0:30 ` [PATCH v2 3/4] Bluetooth: vhci: Add support for setting msft_opcode Luiz Augusto von Dentz
2021-10-13  0:30 ` [PATCH v2 4/4] Bluetooth: vhci: Add support for setting aosp_capable Luiz Augusto von Dentz
2021-10-13  6:45   ` Marcel Holtmann
2021-10-13 21:29     ` Luiz Augusto von Dentz
2021-10-13  2:11 ` [v2,1/4] Bluetooth: Only allow setting msft_opcode at setup stage bluez.test.bot
2021-10-13  6:35 ` [PATCH v2 1/4] " Marcel Holtmann
2021-10-13 21:10   ` Luiz Augusto von Dentz [this message]

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=CABBYNZL6qAMb94Qs1ekmuhm4_u2YB_CAMeUMfHKpDipPxma1eQ@mail.gmail.com \
    --to=luiz.dentz@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --subject='Re: [PATCH v2 1/4] Bluetooth: Only allow setting msft_opcode at setup stage' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).