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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Wed, 11 May 2022 21:35:44 -0700
From:   Luiz Augusto von Dentz <luiz.dentz@...il.com>
To:     Manish Mandlik <mmandlik@...gle.com>
Cc:     Marcel Holtmann <marcel@...tmann.org>,
        ChromeOS Bluetooth Upstreaming 
        <chromeos-bluetooth-upstreaming@...omium.org>,
        "linux-bluetooth@...r.kernel.org" <linux-bluetooth@...r.kernel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Johan Hedberg <johan.hedberg@...il.com>,
        Paolo Abeni <pabeni@...hat.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "open list:NETWORKING [GENERAL]" <netdev@...r.kernel.org>
Subject: Re: [PATCH] Bluetooth: Fix Adv Monitor msft_add/remove_monitor_sync()

Hi Manish,

On Wed, May 11, 2022 at 5:56 PM Manish Mandlik <mmandlik@...gle.com> wrote:
>
> Hi Luiz,
>
> On Wed, May 11, 2022 at 2:23 PM Luiz Augusto von Dentz <luiz.dentz@...il.com> wrote:
>>
>> Hi Manish,
>>
>> On Mon, May 9, 2022 at 2:05 PM Manish Mandlik <mmandlik@...gle.com> wrote:
>> >
>> > Do not call skb_pull() in msft_add_monitor_sync() as
>> > msft_le_monitor_advertisement_cb() expects 'status' to be
>> > part of the skb.
>> >
>> > Same applies for msft_remove_monitor_sync().
>> >
>> > Signed-off-by: Manish Mandlik <mmandlik@...gle.com>
>> > ---
>> >
>> >  net/bluetooth/msft.c | 2 --
>> >  1 file changed, 2 deletions(-)
>> >
>> > diff --git a/net/bluetooth/msft.c b/net/bluetooth/msft.c
>> > index f43994523b1f..9990924719aa 100644
>> > --- a/net/bluetooth/msft.c
>> > +++ b/net/bluetooth/msft.c
>> > @@ -387,7 +387,6 @@ static int msft_remove_monitor_sync(struct hci_dev *hdev,
>> >                 return PTR_ERR(skb);
>> >
>> >         status = skb->data[0];
>> > -       skb_pull(skb, 1);
>> >
>> >         msft_le_cancel_monitor_advertisement_cb(hdev, status, hdev->msft_opcode,
>> >                                                 skb);
>> > @@ -506,7 +505,6 @@ static int msft_add_monitor_sync(struct hci_dev *hdev,
>> >                 return PTR_ERR(skb);
>> >
>> >         status = skb->data[0];
>> > -       skb_pull(skb, 1);
>>
>> Well if it expects it to be part of the skb then there is no reason to
>> pass it as argument in addition to the skb itself.
>
> The problem is msft_le_monitor_advertisement_cb() is invoked directly via msft_add_monitor_sync() and also from __msft_add_monitor_pattern() as a callback from hci_req_run_skb(). So, when it is invoked from hci_req_run_skb() it sends status separately as an argument along with the skb and that's why that argument is required.
>
> Looks like some parts of msft.c still use the old way i.e. hci_req_run_skb() instead of __hci_cmd_sync() after hci_sync related refactoring. I am wondering if it was left like this intentionally? If not, then we probably need to refactor msft.c to use __hci_cmd_sync() for all hci requests. In that case, I can work on refactoring and we can discard this patch altogether. Please let me know.

Yes, if you have time please convert it to use hci_sync.c since we
would like to completely deprecate/remove hci_request.c eventually, if
you think that will take some time we can perhaps merge this changes
first though.

>>
>> >         msft_le_monitor_advertisement_cb(hdev, status, hdev->msft_opcode, skb);
>> >
>> > --
>> > 2.36.0.512.ge40c2bad7a-goog
>> >
>>
>>
>> --
>> Luiz Augusto von Dentz
>
> Regards,
> Manish.



-- 
Luiz Augusto von Dentz

Powered by blists - more mailing lists