Re: [PATCH] PCI/sysfs: NULL res_attr slot after kfree as defence against double-remove
From: Ilpo Järvinen
Date: Thu May 21 2026 - 08:09:01 EST
On Thu, 21 May 2026, Krzysztof Wilczyński wrote:
> > To me it looks more like pci_remove_resource_files() is expected to be
> > entered only once.
> >
> > If this change is accepted, the 2nd entry is "silently" allowed whereas
> > better course of action would feel to catch that in
> > pci_remove_resource_files() with:
> >
> > if (WARN_ON_ONCE(something))
> > return;
> >
> > That way, developers may become aware the code has some lifetime issue.
> >
> > (I'm not strictly against your change but I think it would be much better
> > to have sane lifetimes and catch offenders.)
>
> The upcoming sysfs changes would remove pci_remove_resource_files()
> completely, so there would not be anything needed to be done here,
> hopefully.
Yeah, I should have looked at that branch first instead of checking just
code in mainline.
--
i.