From: "Darrick J. Wong" <djwong@kernel.org>
To: Carlos Maiolino <cem@kernel.org>
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH] xfile: fix missing error unlock in xfile_fcb_find
Date: Mon, 17 Jun 2024 17:57:03 -0700 [thread overview]
Message-ID: <20240618005703.GD103034@frogsfrogsfrogs> (raw)
From: Darrick J. Wong <djwong@kernel.org>
Fix a missing mutex pthread_mutex_unlock and uninitialized return value
in xfile_fcb_find.
Coverity-id: 1604113
Coverity-id: 1604099
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
libxfs/xfile.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libxfs/xfile.c b/libxfs/xfile.c
index fdb76f406647..6e0fa809a296 100644
--- a/libxfs/xfile.c
+++ b/libxfs/xfile.c
@@ -179,7 +179,7 @@ xfile_fcb_find(
{
struct xfile_fcb *fcb;
int ret;
- int error;
+ int error = 0;
/* No maximum range means that the caller gets a private memfd. */
if (maxbytes == 0) {
@@ -222,13 +222,13 @@ xfile_fcb_find(
/* Otherwise, open a new memfd and add it to our list. */
error = xfile_fcb_create(description, &fcb);
if (error)
- return error;
+ goto out_unlock;
ret = ftruncate(fcb->fd, maxbytes);
if (ret) {
error = -errno;
xfile_fcb_irele(fcb, 0, maxbytes);
- return error;
+ goto out_unlock;
}
list_add_tail(&fcb->fcb_list, &fcb_list);
next reply other threads:[~2024-06-18 0:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <A7t-EBUq9-H5Sajvoq6mgbeRxHUyOpyu0OzoCm9hEPzYSxku7_DEwUlAZcUHRA8DoatghRew8uwcIN9iWADZ7w==@protonmail.internalid>
2024-06-18 0:57 ` Darrick J. Wong [this message]
2024-06-18 11:27 ` [PATCH] xfile: fix missing error unlock in xfile_fcb_find Carlos Maiolino
2024-06-19 6:21 ` Christoph Hellwig
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=20240618005703.GD103034@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=linux-xfs@vger.kernel.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