* [PATCH] xfile: fix missing error unlock in xfile_fcb_find
@ 2024-06-18 0:57 ` Darrick J. Wong
2024-06-18 11:27 ` Carlos Maiolino
2024-06-19 6:21 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Darrick J. Wong @ 2024-06-18 0:57 UTC (permalink / raw)
To: Carlos Maiolino; +Cc: linux-xfs
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);
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] xfile: fix missing error unlock in xfile_fcb_find
2024-06-18 0:57 ` [PATCH] xfile: fix missing error unlock in xfile_fcb_find Darrick J. Wong
@ 2024-06-18 11:27 ` Carlos Maiolino
2024-06-19 6:21 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Carlos Maiolino @ 2024-06-18 11:27 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: linux-xfs
On Mon, Jun 17, 2024 at 05:57:03PM GMT, Darrick J. Wong wrote:
> 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>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
> ---
> 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);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] xfile: fix missing error unlock in xfile_fcb_find
2024-06-18 0:57 ` [PATCH] xfile: fix missing error unlock in xfile_fcb_find Darrick J. Wong
2024-06-18 11:27 ` Carlos Maiolino
@ 2024-06-19 6:21 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2024-06-19 6:21 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Carlos Maiolino, linux-xfs
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-06-19 6:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <A7t-EBUq9-H5Sajvoq6mgbeRxHUyOpyu0OzoCm9hEPzYSxku7_DEwUlAZcUHRA8DoatghRew8uwcIN9iWADZ7w==@protonmail.internalid>
2024-06-18 0:57 ` [PATCH] xfile: fix missing error unlock in xfile_fcb_find Darrick J. Wong
2024-06-18 11:27 ` Carlos Maiolino
2024-06-19 6:21 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox