DPDK patches and discussions
 help / color / mirror / Atom feed
From: Harold Huang <baymaxhuang@gmail.com>
To: dev@dpdk.org
Cc: Maxime Coquelin <maxime.coquelin@redhat.com>,
	Chenbo Xia <chenbo.xia@intel.com>
Subject: [PATCH v3] net/virtio: fix unregister virtio user memory event cb problem
Date: Wed, 22 Dec 2021 16:33:49 +0800	[thread overview]
Message-ID: <20211222083349.2034178-1-baymaxhuang@gmail.com> (raw)
In-Reply-To: <20211220124100.1307675-1-baymaxhuang@gmail.com>

When eth_virtio_dev_init is failed, the registered virtio user memory
event cb is not released and creating a new vdev could be failed
because the new virtio_user_dev could use the same address pointer and
register memory event cb to the same address is not allowed.

Signed-off-by: Harold Huang <baymaxhuang@gmail.com>
---
Compared PATCH v2, commit message is changed. The problem this patch want
to solve can be reproduced by ovs 2.16.90 and the latest dpdk.
 drivers/net/virtio/virtio_user_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 0271098f0d..16eca2f940 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -666,6 +666,7 @@ virtio_user_pmd_probe(struct rte_vdev_device *vdev)
 	/* previously called by pci probing for physical dev */
 	if (eth_virtio_dev_init(eth_dev) < 0) {
 		PMD_INIT_LOG(ERR, "eth_virtio_dev_init fails");
+		virtio_user_dev_uninit(dev);
 		virtio_user_eth_dev_free(eth_dev);
 		goto end;
 	}
-- 
2.27.0


  parent reply	other threads:[~2021-12-22  8:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-20 12:41 [PATCH] net/virtio: unregister virtio user memery event to fix memory leak problem Harold Huang
2021-12-20 12:49 ` [PATCH v2] net/virtio: unregister virtio user memory " Harold Huang
2021-12-20 14:08   ` Fwd: " Harold Huang
2021-12-22  8:33 ` Harold Huang [this message]
2021-12-23  4:42 ` [PATCH] net/virtio: fix unreleased resource when creating virtio user dev is failed Harold Huang
2022-01-14  7:48   ` Xia, Chenbo
2022-01-27  5:23   ` Xia, Chenbo

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=20211222083349.2034178-1-baymaxhuang@gmail.com \
    --to=baymaxhuang@gmail.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).