Commit 37c3a17b authored by Zhihao Cheng's avatar Zhihao Cheng Committed by Zhihao Cheng
Browse files

ext4: ext4_iomap_map_blocks: Fix null pointer deference in nojournal mode

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I9DN5Z


CVE: NA

--------------------------------

The 'journal' could be NULL in nojournal mode, which causes a
null-ptr-def problem in ext4_iomap_map_blocks().

Fixes: 7f6416dc ("ext4: implement writeback iomap path")
Signed-off-by: default avatarZhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: default avatarZhihao Cheng <chengzhihao@huaweicloud.com>
parent a3a80cd0
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3878,7 +3878,7 @@ static int ext4_iomap_map_blocks(struct iomap_writepage_ctx *wpc,
		 * ext4_count_free_blocks() is non-zero, a commit
		 * should free up blocks.
		 */
		if (ret == -ENOSPC && ext4_count_free_clusters(sb)) {
		if (ret == -ENOSPC && journal && ext4_count_free_clusters(sb)) {
			jbd2_journal_force_commit_nested(journal);
			goto retry;
		}