From: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
To: Zheng Wang <zyytlz.wz@163.com>
Cc: marcel@holtmann.org, hackerzheng666@gmail.com,
alex000young@gmail.com, johan.hedberg@gmail.com,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, linux-bluetooth@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: hci_core: Fix poential Use-after-Free bug in hci_remove_adv_monitor
Date: Fri, 10 Feb 2023 11:53:23 -0800 [thread overview]
Message-ID: <CABBYNZL_gZ+kr_OEqjYgMmt+=91=jC88g310F-ScMC=kLh0xdw@mail.gmail.com> (raw)
In-Reply-To: <20230210041030.865478-1-zyytlz.wz@163.com>
Hi Zheng,
On Thu, Feb 9, 2023 at 8:11 PM Zheng Wang <zyytlz.wz@163.com> wrote:
>
> In hci_remove_adv_monitor, if it gets into HCI_ADV_MONITOR_EXT_MSFT case,
> the function will free the monitor and print its handle after that.
>
> Fix it by switch the order.
>
> Fixes: 7cf5c2978f23 ("Bluetooth: hci_sync: Refactor remove Adv Monitor")
> Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
> ---
> net/bluetooth/hci_core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index b65c3aabcd53..db3352c60de6 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -1980,9 +1980,9 @@ static int hci_remove_adv_monitor(struct hci_dev *hdev,
> goto free_monitor;
>
> case HCI_ADV_MONITOR_EXT_MSFT:
> - status = msft_remove_monitor(hdev, monitor);
> bt_dev_dbg(hdev, "%s remove monitor %d msft status %d",
> hdev->name, monitor->handle, status);
> + status = msft_remove_monitor(hdev, monitor);
I wonder if it is not a good idea to move the logging inside
msft_remove_monitor?
> break;
> }
>
> --
> 2.25.1
>
--
Luiz Augusto von Dentz
next prev parent reply other threads:[~2023-02-10 19:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-10 4:10 [PATCH] Bluetooth: hci_core: Fix poential Use-after-Free bug in hci_remove_adv_monitor Zheng Wang
2023-02-10 4:35 ` bluez.test.bot
2023-02-10 19:53 ` Luiz Augusto von Dentz [this message]
2023-02-13 3:02 ` [PATCH] " Zheng Hacker
2023-02-13 8:19 ` Paul Menzel
2023-02-13 8:21 ` Zheng Hacker
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='CABBYNZL_gZ+kr_OEqjYgMmt+=91=jC88g310F-ScMC=kLh0xdw@mail.gmail.com' \
--to=luiz.dentz@gmail.com \
--cc=alex000young@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hackerzheng666@gmail.com \
--cc=johan.hedberg@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcel@holtmann.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=zyytlz.wz@163.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.