From: Leah Rumancik <leah.rumancik@gmail.com>
To: linux-xfs@vger.kernel.org
Cc: amir73il@gmail.com, Brian Foster <bfoster@redhat.com>,
"Darrick J . Wong" <djwong@kernel.org>,
Dave Chinner <dchinner@redhat.com>,
Dave Chinner <david@fromorbit.com>,
Leah Rumancik <leah.rumancik@gmail.com>
Subject: [PATCH 5.15 CANDIDATE 2/3] xfs: fix xfs_ifree() error handling to not leak perag ref
Date: Tue, 20 Sep 2022 13:37:49 -0700 [thread overview]
Message-ID: <20220920203750.1989625-3-leah.rumancik@gmail.com> (raw)
In-Reply-To: <20220920203750.1989625-1-leah.rumancik@gmail.com>
From: Brian Foster <bfoster@redhat.com>
[ Upstream commit 6f5097e3367a7c0751e165e4c15bc30511a4ba38 ]
For some reason commit 9a5280b312e2e ("xfs: reorder iunlink remove
operation in xfs_ifree") replaced a jump to the exit path in the
event of an xfs_difree() error with a direct return, which skips
releasing the perag reference acquired at the top of the function.
Restore the original code to drop the reference on error.
Fixes: 9a5280b312e2e ("xfs: reorder iunlink remove operation in xfs_ifree")
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
---
fs/xfs/xfs_inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 36bcdcf3bb78..b2ea85318214 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -2634,7 +2634,7 @@ xfs_ifree(
*/
error = xfs_difree(tp, pag, ip->i_ino, &xic);
if (error)
- return error;
+ goto out;
error = xfs_iunlink_remove(tp, pag, ip);
if (error)
--
2.37.3.968.ga6b4b080e4-goog
next prev parent reply other threads:[~2022-09-20 20:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 20:37 [PATCH 5.15 CANDIDATE 0/3] xfs stable candidate patches (part 5) Leah Rumancik
2022-09-20 20:37 ` [PATCH 5.15 CANDIDATE 1/3] xfs: reorder iunlink remove operation in xfs_ifree Leah Rumancik
2022-09-20 20:37 ` Leah Rumancik [this message]
2022-09-20 20:37 ` [PATCH 5.15 CANDIDATE 3/3] xfs: validate inode fork size against fork format Leah Rumancik
2022-09-21 0:36 ` [PATCH 5.15 CANDIDATE 0/3] xfs stable candidate patches (part 5) Darrick J. Wong
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=20220920203750.1989625-3-leah.rumancik@gmail.com \
--to=leah.rumancik@gmail.com \
--cc=amir73il@gmail.com \
--cc=bfoster@redhat.com \
--cc=david@fromorbit.com \
--cc=dchinner@redhat.com \
--cc=djwong@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