linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 5/5] libfrog: fix workqueue_add error out
Date: Tue, 22 Oct 2019 11:47:02 -0700	[thread overview]
Message-ID: <157177002278.1458930.9155151793278556546.stgit@magnolia> (raw)
In-Reply-To: <157176999124.1458930.5678023201951458107.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

Don't forget to unlock before erroring out.

Coverity-id: 1454843
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 libfrog/workqueue.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)


diff --git a/libfrog/workqueue.c b/libfrog/workqueue.c
index 07f11a7b..a93bba3d 100644
--- a/libfrog/workqueue.c
+++ b/libfrog/workqueue.c
@@ -142,8 +142,11 @@ workqueue_add(
 	if (wq->next_item == NULL) {
 		assert(wq->item_count == 0);
 		ret = pthread_cond_signal(&wq->wakeup);
-		if (ret)
-			goto out_item;
+		if (ret) {
+			pthread_mutex_unlock(&wq->lock);
+			free(wi);
+			return ret;
+		}
 		wq->next_item = wi;
 	} else {
 		wq->last_item->next = wi;
@@ -153,9 +156,6 @@ workqueue_add(
 	pthread_mutex_unlock(&wq->lock);
 
 	return 0;
-out_item:
-	free(wi);
-	return ret;
 }
 
 /*


  parent reply	other threads:[~2019-10-22 18:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22 18:46 [PATCH 0/5] xfsprogs: random fixes Darrick J. Wong
2019-10-22 18:46 ` [PATCH 1/5] xfs_spaceman: always report sick metadata, checked or not Darrick J. Wong
2019-11-01 18:17   ` Eric Sandeen
2019-11-01 18:40     ` Darrick J. Wong
2019-11-01 18:44       ` Darrick J. Wong
2019-10-22 18:46 ` [PATCH 2/5] xfs_db: btheight should check geometry more carefully Darrick J. Wong
2019-11-01 18:21   ` Eric Sandeen
2019-10-22 18:46 ` [PATCH 3/5] xfs_scrub: report repair activities on stdout, not stderr Darrick J. Wong
2019-11-01 18:26   ` Eric Sandeen
2019-11-01 18:42     ` Darrick J. Wong
2019-10-22 18:46 ` [PATCH 4/5] xfs_scrub: don't allow error or negative error injection interval Darrick J. Wong
2019-11-01 18:31   ` Eric Sandeen
2019-10-22 18:47 ` Darrick J. Wong [this message]
2019-11-01 18:33   ` [PATCH 5/5] libfrog: fix workqueue_add error out Eric Sandeen
2019-10-30 17:52 ` [PATCH 6/5] xfs_repair: print better information when metadata updates fail Darrick J. Wong
2019-11-01 18:42   ` Eric Sandeen
2019-10-30 17:53 ` [PATCH 7/5] libxfs: fix typo in message about write verifier Darrick J. Wong
2019-11-01 18:44   ` Eric Sandeen
2019-11-01 18:52 ` [PATCH 8/5] mkfs: fix incorrect error message Darrick J. Wong
2019-11-01 19:28   ` Eric Sandeen

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=157177002278.1458930.9155151793278556546.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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).