Skip to content

Commit

Permalink
f2fs: fix to avoid accessing invalid fio in f2fs_allocate_data_block()
Browse files Browse the repository at this point in the history
Callers may pass fio parameter with NULL value to f2fs_allocate_data_block(),
so we should make sure accessing fio's field after fio's validation check.

Fixes: f608c38 ("f2fs: clean up parameter of f2fs_allocate_data_block()")
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Chao Yu authored and Jaegeuk Kim committed Apr 6, 2021
1 parent a303b0a commit 25ae837
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/f2fs/segment.c
Original file line number Diff line number Diff line change
Expand Up @@ -3417,12 +3417,12 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,
f2fs_inode_chksum_set(sbi, page);
}

if (F2FS_IO_ALIGNED(sbi))
fio->retry = false;

if (fio) {
struct f2fs_bio_info *io;

if (F2FS_IO_ALIGNED(sbi))
fio->retry = false;

INIT_LIST_HEAD(&fio->list);
fio->in_list = true;
io = sbi->write_io[fio->type] + fio->temp;
Expand Down

0 comments on commit 25ae837

Please sign in to comment.