linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Damien Le Moal <dlemoal@kernel.org>
To: Niklas Cassel <cassel@kernel.org>
Cc: linux-pci@vger.kernel.org,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>
Subject: Re: [PATCH] PCI: endpoint: Fix configfs group removal on driver teardown
Date: Tue, 24 Jun 2025 09:58:14 +0900	[thread overview]
Message-ID: <d6e06fab-2cb8-4645-93b9-e20a70f2aad1@kernel.org> (raw)
In-Reply-To: <aFlYCRtF40Y2i7dX@ryzen>

On 6/23/25 10:35 PM, Niklas Cassel wrote:
> On Mon, Jun 23, 2025 at 09:01:53PM +0900, Damien Le Moal wrote:
>> On 6/23/25 19:00, Niklas Cassel wrote:
>>>
>>> I think it is a litte bit confusing that you attach a KASAN
>>> splat to a patch that fixes two different bugs.
>>>
>>> Surely this KASAN bug can be fixes with only:
>>>
>>> -     list_del(&driver->epf_group);
>>> +     WARN_ON(!list_empty(&driver->epf_group));
>>
>> Yes, with that, you will not get the KASAN warning, but you will get the
>> WARN_ON() to trigger unless bug #1 is applied first. But if you apply #1 first,
>> then any testing done with that bug fix only will trigger a NULL pointer
>> de-reference on the list_del().
> 
> Ok, let me rephrase :)
> 
> Surely this KASAN bug can be fixed with only:
> 
> -     list_del(&driver->epf_group);
> 
> As the bug is that the code is trying to delete a list head, which is just
> wrong.
> 
> 
> A patch 2/2 could add a list_del() to pci_ep_cfs_remove_epf_group() and the
> WARN_ON() to pci_epf_remove_cfs().
> 
> Considering that pci_ep_cfs_remove_epf_group() also frees the memory for
> the group, I think it is more correct to use list_del() rather than
> list_del_init(), as no one will be able to re-use this group after calling
> pci_ep_cfs_remove_epf_group() on it.

OK. Sending v2.


-- 
Damien Le Moal
Western Digital Research

      reply	other threads:[~2025-06-24  1:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-17  1:07 [PATCH] PCI: endpoint: Fix configfs group removal on driver teardown Damien Le Moal
2025-06-20  3:04 ` Damien Le Moal
2025-06-23 10:00 ` Niklas Cassel
2025-06-23 12:01   ` Damien Le Moal
2025-06-23 13:35     ` Niklas Cassel
2025-06-24  0:58       ` Damien Le Moal [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=d6e06fab-2cb8-4645-93b9-e20a70f2aad1@kernel.org \
    --to=dlemoal@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=cassel@kernel.org \
    --cc=kishon@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mani@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).