summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJaegeuk Kim2015-12-23 23:17:47 +0100
committerJaegeuk Kim2015-12-30 19:14:12 +0100
commit4aa69d5667914dd0844d98ad84804b79a4845fa3 (patch)
tree16b2012fcf7aa4718999d1f38b31d63eb44f01a4 /fs
parentf2fs: introduce prepare_write_begin to clean up (diff)
downloadkernel-qcow2-linux-4aa69d5667914dd0844d98ad84804b79a4845fa3.tar.gz
kernel-qcow2-linux-4aa69d5667914dd0844d98ad84804b79a4845fa3.tar.xz
kernel-qcow2-linux-4aa69d5667914dd0844d98ad84804b79a4845fa3.zip
f2fs: return early when trying to read null nid
If get_node_page() gets zero nid, we can return early without getting a wrong page. For example, get_dnode_of_data() can try to do that. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/f2fs/node.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index 341de5d2353b..929265d20c32 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -1059,6 +1059,10 @@ struct page *get_node_page(struct f2fs_sb_info *sbi, pgoff_t nid)
{
struct page *page;
int err;
+
+ if (!nid)
+ return ERR_PTR(-ENOENT);
+ f2fs_bug_on(sbi, check_nid_range(sbi, nid));
repeat:
page = grab_cache_page(NODE_MAPPING(sbi), nid);
if (!page)