From: "Renyong Wan" <wanry@yunsilicon.com>
To: <dev@dpdk.org>
Cc: "Stephen Hemminger" <stephen@networkplumber.org>,
<nana@yunsilicon.com>, <qianr@yunsilicon.com>,
<zhangxx@yunsilicon.com>, <xudw@yunsilicon.com>,
<stable@dpdk.org>
Subject: [PATCH v5 2/4] net/xsc: fix leak on device init failure
Date: Sun, 22 Nov 2026 22:22:36 +0800 [thread overview]
Message-ID: <1795357356.655948@yunsilicon.com> (raw)
In-Reply-To: <1795357356.312312@yunsilicon.com>
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@dpdk.org
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Renyong Wan <wanry@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;
}
next prev parent reply other threads:[~2026-11-22 14:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 14:22 [PATCH v5 0/4] net/xsc: fix issues reported by GCC analyzer Renyong Wan
2026-11-22 14:22 ` Renyong Wan [this message]
2026-11-22 14:22 ` [PATCH v5 1/4] net/xsc: fix jumbo buffer allocation and leak Renyong Wan
2026-11-22 14:22 ` [PATCH v5 3/4] net/xsc: check Tx queue allocation result Renyong Wan
2026-11-22 14:22 ` [PATCH v5 4/4] net/xsc: rename jumbo buffer fields Renyong Wan
2026-11-22 17:47 ` [PATCH v5 0/4] net/xsc: fix issues reported by GCC analyzer Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1795357356.655948@yunsilicon.com \
--to=wanry@yunsilicon.com \
--cc=dev@dpdk.org \
--cc=nana@yunsilicon.com \
--cc=qianr@yunsilicon.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=xudw@yunsilicon.com \
--cc=zhangxx@yunsilicon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.