Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cxl: Free virtual PHB when removing

When adding a vPHB in cxl_pci_vphb_add(), we allocate a pci_controller
struct using pcibios_alloc_controller(). However, we don't free it in
cxl_pci_vphb_remove(), causing a leak.

Call pcibios_free_controller() in cxl_pci_vphb_remove() to free the vPHB
data structure correctly.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Andrew Donnellan and committed by
Michael Ellerman
2e1a2556 6b8b252f

+2
+2
drivers/misc/cxl/vphb.c
··· 290 290 return; 291 291 292 292 phb = afu->phb; 293 + afu->phb = NULL; 293 294 294 295 pci_remove_root_bus(phb->bus); 296 + pcibios_free_controller(phb); 295 297 } 296 298 297 299 struct cxl_afu *cxl_pci_to_afu(struct pci_dev *dev)