dma/idxd: fix memory leak in PCI close
authorKevin Laatz <kevin.laatz@intel.com>
Mon, 4 Jul 2022 15:27:49 +0000 (16:27 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 5 Jul 2022 19:19:00 +0000 (21:19 +0200)
commit8a6eb404c4a1e312a13d3a374b0cf3dcdc429ba7
tree7d0b1382a5f645db07112fc352052f36bba1da16
parent81e3122fe168eaccd381263ca4814205772cbc2d
dma/idxd: fix memory leak in PCI close

ASAN reports a memory leak for the 'pci' pointer in the 'idxd_dmadev'
struct.

This is fixed by free'ing the struct when the last queue on the PCI
device is being closed.

Fixes: 9449330a8458 ("dma/idxd: create dmadev instances on PCI probe")
Cc: stable@dpdk.org
Reported-by: Xingguang He <xingguang.he@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
drivers/dma/idxd/idxd_internal.h
drivers/dma/idxd/idxd_pci.c