diff mbox series

[RFC,02/11] PCI: proc: Nullify a freed pointer

Message ID 20191024172157.878735-3-s.miroshnichenko@yadro.com
State New
Delegated to: Bjorn Helgaas
Headers show
Series PCI: hotplug: Movable bus numbers | expand

Commit Message

Sergei Miroshnichenko Oct. 24, 2019, 5:21 p.m. UTC
A PCI device may be detached from /proc/bus/pci/devices not only when it is
removed, but also when its bus had changed the number - in this case the
proc entry must be recreated to reflect the new PCI topology.

Nullify freed pointers to mark them as valid for allocating again.

Signed-off-by: Sergey Miroshnichenko <s.miroshnichenko@yadro.com>
---
 drivers/pci/proc.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index 5495537c60c2..c85654dd315b 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -443,6 +443,7 @@  int pci_proc_detach_device(struct pci_dev *dev)
 int pci_proc_detach_bus(struct pci_bus *bus)
 {
 	proc_remove(bus->procdir);
+	bus->procdir = NULL;
 	return 0;
 }