mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: Cen Zhang <zzzccc427@gmail.com>, linux-bluetooth@vger.kernel.org
Cc: Cen Zhang <zzzccc427@163.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Johan Hedberg <johan.hedberg@gmail.com>,
	Luiz Von Dentz <luiz.dentz@gmail.com>,
	Marcel Holtmann <marcel@holtmann.org>
Subject: Re: [PATCH] Bluetooth: hci_sync: fix race in hci_cmd_sync_dequeue_once
Date: Sun, 28 Sep 2025 13:39:03 +0200	[thread overview]
Message-ID: <9b865b1f-fd7f-4378-a512-2c67dfff675f@web.de> (raw)
In-Reply-To: <20250928110740.137220-1-zzzccc427@163.com>

> hci_cmd_sync_dequeue_once() does lookup and then cancel
> the entry under two separate lock sections. Meanwhile,
> hci_cmd_sync_work() can also delete the same entry,
> leading to double list_del() and "UAF".

You may occasionally put more than 55 characters into text lines
of such a change description.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc7#n658


> Fix this by holding cmd_sync_work_lock across both
> lookup and cancel, so that the entry cannot be removed
> concurrently.
…
> +++ b/net/bluetooth/hci_sync.c
> @@ -862,12 +862,13 @@ bool hci_cmd_sync_dequeue_once(struct hci_dev *hdev,
…

* How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?

* Under which circumstances would you become interested to apply a call
  like “scoped_guard(mutex, &hdev->cmd_sync_work_lock)”?
  https://elixir.bootlin.com/linux/v6.17-rc7/source/include/linux/mutex.h#L228


Regards,
Markus

      reply	other threads:[~2025-09-28 11:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-28 11:07 Cen Zhang
2025-09-28 11:39 ` Markus Elfring [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=9b865b1f-fd7f-4378-a512-2c67dfff675f@web.de \
    --to=markus.elfring@web.de \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=zzzccc427@163.com \
    --cc=zzzccc427@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®