]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfile: fix missing error unlock in xfile_fcb_find
authorDarrick J. Wong <djwong@kernel.org>
Tue, 18 Jun 2024 00:57:03 +0000 (17:57 -0700)
committerCarlos Maiolino <cem@kernel.org>
Mon, 22 Jul 2024 09:21:02 +0000 (11:21 +0200)
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>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/xfile.c

index fdb76f406647b466aa5e42a1291b61a3cf30e16c..6e0fa809a29654d2f7c3a042607f17180d43b5a4 100644 (file)
@@ -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);