From: Jason Hrycay Date: Fri, 31 May 2013 17:45:11 +0000 (-0500) Subject: f2fs: handle errors from get_node_page calls X-Git-Tag: firefly_0821_release~176^2~5850^2~21 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1e03e38b35b8e72d65fd5d931627bd6ff02926c1;p=firefly-linux-kernel-4.4.55.git f2fs: handle errors from get_node_page calls Add check for error pointers returned from get_node_page in order to avoid dereferencing a bad address on the next use. Signed-off-by: Jason Hrycay Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c index 0b02dce31356..ae61f359554f 100644 --- a/fs/f2fs/xattr.c +++ b/fs/f2fs/xattr.c @@ -218,6 +218,8 @@ int f2fs_getxattr(struct inode *inode, int name_index, const char *name, return -ENODATA; page = get_node_page(sbi, fi->i_xattr_nid); + if (IS_ERR(page)) + return PTR_ERR(page); base_addr = page_address(page); list_for_each_xattr(entry, base_addr) { @@ -268,6 +270,8 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) return 0; page = get_node_page(sbi, fi->i_xattr_nid); + if (IS_ERR(page)) + return PTR_ERR(page); base_addr = page_address(page); list_for_each_xattr(entry, base_addr) {