Re: PCI/MSI: Destroy sysfs before freeing entries

From: Greg Kroah Hartmann
Date: Tue Nov 09 2021 - 10:39:51 EST


On Tue, Nov 09, 2021 at 02:53:57PM +0100, Thomas Gleixner wrote:
> free_msi_irqs() frees the MSI entries before destroying the sysfs entries
> which are exposing them. Nothing prevents a concurrent free while a sysfs
> file is read and accesses the possibly freed entry.
>
> Move the sysfs release ahead of freeing the entries.
>
> Fixes: 1c51b50c2995 ("PCI/MSI: Export MSI mode using attributes, not kobjects")
> Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
> Cc: stable@xxxxxxxxxxxxxxx
> ---
> drivers/pci/msi.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)

Reviewed-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>