[PATCH v5 2/4] net/xsc: fix leak on device init failure
Renyong Wan
wanry at yunsilicon.com
Sun Nov 22 15:22:36 CET 2026
xsc_dev_init() leaks the structure when the dev_ops lookup fails. Free
it there: xsc_dev_uninit() cannot be used, as xsc_dev_close()
dereferences xdev->dev_ops.
Fixes: fb7d4f7ae39a ("net/xsc: add device initialization")
Cc: stable at dpdk.org
Reported-by: Stephen Hemminger <stephen at networkplumber.org>
Signed-off-by: Renyong Wan <wanry at yunsilicon.com>
---
drivers/net/xsc/xsc_dev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/xsc/xsc_dev.c b/drivers/net/xsc/xsc_dev.c
index 953409a9..f048efd7 100644
--- a/drivers/net/xsc/xsc_dev.c
+++ b/drivers/net/xsc/xsc_dev.c
@@ -375,6 +375,7 @@ xsc_dev_init(struct rte_pci_device *pci_dev, struct xsc_dev **xdev)
d->dev_ops = xsc_dev_ops_get(pci_dev->kdrv);
if (d->dev_ops == NULL) {
PMD_DRV_LOG(ERR, "Could not get dev_ops, kdrv=%d", pci_dev->kdrv);
+ rte_free(d);
return -ENODEV;
}
More information about the dev
mailing list