PCI/MSI: Destroy sysfs before freeing entries
authorThomas Gleixner <tglx@linutronix.de>
Tue, 9 Nov 2021 13:53:57 +0000 (14:53 +0100)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 11 Nov 2021 08:50:31 +0000 (09:50 +0100)
commit3735459037114d31e5acd9894fad9aed104231a0
tree8889f1aa3106cf48b733f6c9a6ae19f5f9491128
parentf21082fb20dbfb3e42b769b59ef21c2a7f2c7c1f
PCI/MSI: Destroy sysfs before freeing entries

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@linutronix.de>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Bjorn Helgaas <helgaas@kernel.org>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/87sfw5305m.ffs@tglx
drivers/pci/msi.c