Message ID | 1449770240-103240-5-git-send-email-huawei.xie@intel.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
> -----Original Message----- > From: Huawei Xie > Sent: Thursday, December 10, 2015 5:57 PM > To: dev@dpdk.org > Cc: Mcnamara, John; Xie, Huawei > Subject: [PATCH 3/4] vhost: Fix Coverity issue with missed unlocking > > 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> Acked-by: John McNamara <john.mcnamara@intel.com>
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++;
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(-)