From: Darrick J. Wong Date: Tue, 18 Jun 2024 00:57:03 +0000 (-0700) Subject: xfile: fix missing error unlock in xfile_fcb_find X-Git-Tag: v6.10.0~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2dee3eb74b0173b04ca06f641ff325bc40e053c5;p=thirdparty%2Fxfsprogs-dev.git xfile: fix missing error unlock in xfile_fcb_find 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 Reviewed-by: Carlos Maiolino Reviewed-by: Christoph Hellwig --- diff --git a/libxfs/xfile.c b/libxfs/xfile.c index fdb76f40..6e0fa809 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);