DPDK patches and discussions
 help / color / mirror / Atom feed
From: David C Harton <dharton@cisco.com>
To: yliu@fridaylinux.org, maxime.coquelin@redhat.com, tiwei.bie@intel.com
Cc: dev@dpdk.org, David C Harton <dharton@cisco.com>, olivier.matz@6wind.com
Subject: [dpdk-dev] [PATCH] net/virtio: Fix crash in virtio_dev_free_mbufs
Date: Sat,  3 Feb 2018 09:55:23 -0500	[thread overview]
Message-ID: <20180203145523.28013-1-dharton@cisco.com> (raw)

virtio_dev_free_mbufs was recently modified to free the
virtqueues but failed to check whether the array was
allocated.  Added a check to ensure vqs was non-null.

Fixes: bdb32afbb610 ("net/virtio: rationalize queue flushing")
Cc: olivier.matz@6wind.com

Signed-off-by: David C Harton <dharton@cisco.com>
---
 drivers/net/virtio/virtio_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 2082d6a..884f74a 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -1975,6 +1975,9 @@ static void virtio_dev_free_mbufs(struct rte_eth_dev *dev)
 	struct rte_mbuf *buf;
 	int queue_type;
 
+	if (hw->vqs == NULL)
+		return;
+
 	for (i = 0; i < nr_vq; i++) {
 		vq = hw->vqs[i];
 		if (!vq)
-- 
2.10.3.dirty

             reply	other threads:[~2018-02-03 14:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-03 14:55 David C Harton [this message]
2018-02-05  8:17 ` Olivier Matz
2018-02-05  8:44 ` Maxime Coquelin
2018-02-05 18:52 ` Ferruh Yigit

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=20180203145523.28013-1-dharton@cisco.com \
    --to=dharton@cisco.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=olivier.matz@6wind.com \
    --cc=tiwei.bie@intel.com \
    --cc=yliu@fridaylinux.org \
    /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).