DPDK patches and discussions
 help / color / mirror / Atom feed
From: Huawei Xie
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 3/4] vhost: Fix Coverity issue with missed unlocking
Date: Fri, 11 Dec 2015 01:57:19 +0800	[thread overview]
Message-ID: <1449770240-103240-5-git-send-email-huawei.xie@intel.com> (raw)
In-Reply-To: <1449770240-103240-1-git-send-email-huawei.xie@intel.com>

CID 107113 (#1 of 1): Missing unlock (LOCK)5. missing_unlock: Returning
without unlocking pfdset->fd_mutex.
Fixes: fbf7e07ca142 ("vhost: add select based event driven processing")

Signed-off-by: Huawei Xie <huawei.xie@intel.com>
---
 lib/librte_vhost/vhost_user/fd_man.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/librte_vhost/vhost_user/fd_man.c b/lib/librte_vhost/vhost_user/fd_man.c
index d68b270..087aaed 100644
--- a/lib/librte_vhost/vhost_user/fd_man.c
+++ b/lib/librte_vhost/vhost_user/fd_man.c
@@ -150,8 +150,10 @@ fdset_add(struct fdset *pfdset, int fd, fd_cb rcb, fd_cb wcb, void *dat)
 
 	/* Find a free slot in the list. */
 	i = fdset_find_free_slot(pfdset);
-	if (i == -1)
+	if (i == -1) {
+		pthread_mutex_unlock(&pfdset->fd_mutex);
 		return -2;
+	}
 
 	fdset_add_fd(pfdset, i, fd, rcb, wcb, dat);
 	pfdset->num++;
-- 
1.8.1.4

  parent reply	other threads:[~2015-12-11  9:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-10 17:57 [dpdk-dev] [PATCH 0/4] vhost: Fix various coverity issues in vhost library Huawei
2015-12-10 17:57 ` [dpdk-dev] [PATCH 1/4] vhost: Fix Coverity issue with possible array out-of-bounds read Huawei
2015-12-11 14:48   ` Mcnamara, John
2015-12-11 14:57     ` Xie, Huawei
2015-12-10 17:57 ` [dpdk-dev] [PATCH] virtio: fix virtio_net_hdr desc pointing to the same buffer Huawei
2015-12-10 17:57 ` [dpdk-dev] [PATCH 2/4] vhost: Fix Coverity issue with missed break in switch Huawei
2015-12-11 14:51   ` Mcnamara, John
2015-12-10 17:57 ` Huawei [this message]
2015-12-11 14:53   ` [dpdk-dev] [PATCH 3/4] vhost: Fix Coverity issue with missed unlocking Mcnamara, John
2015-12-10 17:57 ` [dpdk-dev] [PATCH 4/4] vhost: Fix Coverity issue with logically dead code Huawei
2015-12-11 14:54   ` Mcnamara, John
2015-12-13  1:16 ` [dpdk-dev] [PATCH 0/4] vhost: Fix various coverity issues in vhost library Thomas Monjalon

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=1449770240-103240-5-git-send-email-huawei.xie@intel.com \
    --to=dev@dpdk.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).