summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Ian King <colin.king@canonical.com>2021-03-04 09:21:18 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-22 10:40:30 +0200
commite12d8b1ca69a70e29d9ac7e09c92cb7fe63b363b (patch)
tree242254f28d3a0e91836186dcd09f11ac510d0abf
parent2101b9c66072fdb1610c18813d70d545bbfe41a8 (diff)
downloadlinux-stable-e12d8b1ca69a70e29d9ac7e09c92cb7fe63b363b.tar.gz
linux-stable-e12d8b1ca69a70e29d9ac7e09c92cb7fe63b363b.tar.bz2
linux-stable-e12d8b1ca69a70e29d9ac7e09c92cb7fe63b363b.zip
f2fs: fix a redundant call to f2fs_balance_fs if an error occurs
[ Upstream commit 28e18ee636ba28532dbe425540af06245a0bbecb ] The uninitialized variable dn.node_changed does not get set when a call to f2fs_get_node_page fails. This uninitialized value gets used in the call to f2fs_balance_fs() that may or not may not balances dirty node and dentry pages depending on the uninitialized state of the variable. Fix this by only calling f2fs_balance_fs if err is not set. Thanks to Jaegeuk Kim for suggesting an appropriate fix. Addresses-Coverity: ("Uninitialized scalar variable") Fixes: 2a3407607028 ("f2fs: call f2fs_balance_fs only when node was changed") Signed-off-by: Colin Ian King <colin.king@canonical.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/f2fs/inline.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 482888ee8942..481fae63f163 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -196,7 +196,8 @@ out:
f2fs_put_page(page, 1);
- f2fs_balance_fs(sbi, dn.node_changed);
+ if (!err)
+ f2fs_balance_fs(sbi, dn.node_changed);
return err;
}