From: "Krzysztof Wilczyński" <kw@linux.com>
To: Gianfranco Dutka <gianfranco.dutka@arista.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI/sysfs: NULL res_attr slot after kfree as defence against double-remove
Date: Thu, 21 May 2026 20:59:02 +0900 [thread overview]
Message-ID: <20260521115433.GB647881@rocinante> (raw)
In-Reply-To: <20260520211306.3301893-1-gianfranco.dutka@arista.com>
Hello,
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -1228,11 +1228,13 @@ static void pci_remove_resource_files(struct pci_dev *pdev)
> if (res_attr) {
> sysfs_remove_bin_file(&pdev->dev.kobj, res_attr);
> kfree(res_attr);
> + pdev->res_attr[i] = NULL;
> }
>
> res_attr = pdev->res_attr_wc[i];
> if (res_attr) {
> sysfs_remove_bin_file(&pdev->dev.kobj, res_attr);
> kfree(res_attr);
> + pdev->res_attr_wc[i] = NULL;
> }
> }
> }
Similar such patches (for reference):
- https://lore.kernel.org/linux-pci/20251010093023.2569-1-guojinhui.liam@bytedance.com/
- https://lore.kernel.org/linux-pci/20250629030547.1073425-1-zhangjian496@huawei.com/
- https://lore.kernel.org/linux-pci/20210507102706.7658-1-danijel.slivka@amd.com/
- https://lore.kernel.org/linux-pci/20191024172157.878735-2-s.miroshnichenko@yadro.com/
Thank you!
Krzysztof
prev parent reply other threads:[~2026-05-21 11:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 21:13 Gianfranco Dutka
2026-05-20 22:45 ` Gianfranco Dutka
2026-05-21 11:54 ` Krzysztof Wilczyński
2026-05-21 10:22 ` Ilpo Järvinen
2026-05-21 12:01 ` Krzysztof Wilczyński
2026-05-21 12:04 ` Ilpo Järvinen
2026-05-21 11:59 ` Krzysztof Wilczyński [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=20260521115433.GB647881@rocinante \
--to=kw@linux.com \
--cc=bhelgaas@google.com \
--cc=gianfranco.dutka@arista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.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
all inboxes | Powered by JetHome®