linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: use IS_ERR() for error checking of path
@ 2020-10-27 20:43 Harshad Shirwadkar
  2020-10-28 15:55 ` Theodore Y. Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Harshad Shirwadkar @ 2020-10-27 20:43 UTC (permalink / raw)
  To: linux-ext4; +Cc: tytso, Harshad Shirwadkar, Dan Carpenter

With this fix, fast commit recovery code uses IS_ERR() for path
returned by ext4_find_extent.

Fixes: 8016e29f4362 ("ext4: fast commit recovery path")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>
---
 fs/ext4/fast_commit.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/fast_commit.c b/fs/ext4/fast_commit.c
index 3ee43fd6d5aa..8d43058386c3 100644
--- a/fs/ext4/fast_commit.c
+++ b/fs/ext4/fast_commit.c
@@ -1616,8 +1616,10 @@ static int ext4_fc_replay_add_range(struct super_block *sb,
 		if (ret == 0) {
 			/* Range is not mapped */
 			path = ext4_find_extent(inode, cur, NULL, 0);
-			if (!path)
-				continue;
+			if (IS_ERR(path)) {
+				iput(inode);
+				return 0;
+			}
 			memset(&newex, 0, sizeof(newex));
 			newex.ee_block = cpu_to_le32(cur);
 			ext4_ext_store_pblock(
-- 
2.29.0.rc2.309.g374f81d7ae-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ext4: use IS_ERR() for error checking of path
  2020-10-27 20:43 [PATCH] ext4: use IS_ERR() for error checking of path Harshad Shirwadkar
@ 2020-10-28 15:55 ` Theodore Y. Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Y. Ts'o @ 2020-10-28 15:55 UTC (permalink / raw)
  To: Harshad Shirwadkar; +Cc: linux-ext4, Dan Carpenter

On Tue, Oct 27, 2020 at 01:43:42PM -0700, Harshad Shirwadkar wrote:
> With this fix, fast commit recovery code uses IS_ERR() for path
> returned by ext4_find_extent.
> 
> Fixes: 8016e29f4362 ("ext4: fast commit recovery path")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Harshad Shirwadkar <harshadshirwadkar@gmail.com>

Thanks, applied.

				- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-10-28 21:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-27 20:43 [PATCH] ext4: use IS_ERR() for error checking of path Harshad Shirwadkar
2020-10-28 15:55 ` Theodore Y. Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).