From: Niklas Cassel <cassel@kernel.org>
To: Damien Le Moal <dlemoal@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: Mon, 23 Jun 2025 15:35:05 +0200 [thread overview]
Message-ID: <aFlYCRtF40Y2i7dX@ryzen> (raw)
In-Reply-To: <011c4c6d-ebff-46e4-b32f-f93eb88dd82d@kernel.org>
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.
Kind regards,
Niklas
next prev parent reply other threads:[~2025-06-23 13:35 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 [this message]
2025-06-24 0:58 ` Damien Le Moal
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=aFlYCRtF40Y2i7dX@ryzen \
--to=cassel@kernel.org \
--cc=bhelgaas@google.com \
--cc=dlemoal@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