summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarshad Shirwadkar <harshadshirwadkar@gmail.com>2020-10-27 13:43:42 -0700
committerTheodore Ts'o <tytso@mit.edu>2020-10-28 13:43:07 -0400
commit8c9be1e58a8dc03ef815ca51ece95c5e6862b25e (patch)
tree31c6823c71234ac714dc71ed04b3c7f99b05ed60
parentb5b18160a3e7a9f55e3528d77051670cca6d9314 (diff)
downloadlinux-8c9be1e58a8dc03ef815ca51ece95c5e6862b25e.tar.gz
linux-8c9be1e58a8dc03ef815ca51ece95c5e6862b25e.tar.bz2
linux-8c9be1e58a8dc03ef815ca51ece95c5e6862b25e.zip
ext4: use IS_ERR() for error checking of path
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> Link: https://lore.kernel.org/r/20201027204342.2794949-1-harshadshirwadkar@gmail.com Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r--fs/ext4/fast_commit.c6
1 files 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(