Commit 8908e753 authored by Chao Yu's avatar Chao Yu Committed by Jaegeuk Kim

f2fs: fix to verify tpage before releasing in f2fs_free_dic()

In below error path, tpages[i] could be NULL, fix to check it before
releasing it.
- f2fs_read_multi_pages
 - f2fs_alloc_dic
  - f2fs_free_dic

Fixes: 61fbae2b ("f2fs: fix to avoid NULL pointer dereference")
Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent fd26725f
...@@ -1333,6 +1333,8 @@ void f2fs_free_dic(struct decompress_io_ctx *dic) ...@@ -1333,6 +1333,8 @@ void f2fs_free_dic(struct decompress_io_ctx *dic)
for (i = 0; i < dic->cluster_size; i++) { for (i = 0; i < dic->cluster_size; i++) {
if (dic->rpages[i]) if (dic->rpages[i])
continue; continue;
if (!dic->tpages[i])
continue;
unlock_page(dic->tpages[i]); unlock_page(dic->tpages[i]);
put_page(dic->tpages[i]); put_page(dic->tpages[i]);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment