DPDK patches and discussions
 help / color / mirror / Atom feed
From: Aaron Conole <aconole@redhat.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, Maxime Coquelin <maxime.coquelin@redhat.com>,
	Tiwei Bie <tiwei.bie@intel.com>,
	Zhihong Wang <zhihong.wang@intel.com>,
	Pengzhen Liu <liupengzhen3@huawei.com>
Subject: [dpdk-dev] [PATCH] net/virtio: fix dangling pointer on failure
Date: Mon, 15 Apr 2019 10:48:18 -0400	[thread overview]
Message-ID: <20190415144818.26600-1-aconole@redhat.com> (raw)

When eth_virtio_dev_init() is cleaning up, it does not correctly set
the mac_addrs variable to NULL, which will lead to a double free.

Found during unit-test fixes.

Fixes: 43d18765c027 ("net/virtio: fix memory leak on failure")
Cc: stable@dpdk.org
Reported-by: Michael Santana <msantana@redhat.com>
Signed-off-by: Aaron Conole <aconole@redhat.com>
---
 drivers/net/virtio/virtio_ethdev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 2272bb2e5..d25c08f0a 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1862,6 +1862,7 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
 
 out:
 	rte_free(eth_dev->data->mac_addrs);
+	eth_dev->data->mac_addrs = NULL;
 	return ret;
 }
 
-- 
2.19.1

             reply	other threads:[~2019-04-15 14:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-15 14:48 Aaron Conole [this message]
2019-04-15 14:48 ` Aaron Conole
2019-04-16  5:19 ` Tiwei Bie
2019-04-16  5:19   ` Tiwei Bie
2019-04-17  7:52 ` Maxime Coquelin
2019-04-17  7:52   ` Maxime Coquelin

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=20190415144818.26600-1-aconole@redhat.com \
    --to=aconole@redhat.com \
    --cc=dev@dpdk.org \
    --cc=liupengzhen3@huawei.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=stable@dpdk.org \
    --cc=tiwei.bie@intel.com \
    --cc=zhihong.wang@intel.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).