summaryrefslogtreecommitdiff
path: root/fs/f2fs
diff options
context:
space:
mode:
authorJason Hrycay <jhrycay@gmail.com>2013-05-31 12:45:11 -0500
committerChanho Park <chanho61.park@samsung.com>2014-11-18 11:43:49 +0900
commit13be0c17d490290ff5222e3000c1738a8c845333 (patch)
treec8ee51503b5fc38bf2036e510744323ae033253e /fs/f2fs
parentf4d659629dfdd8be15b50a0e782e7f62614eee8b (diff)
downloadlinux-3.10-13be0c17d490290ff5222e3000c1738a8c845333.tar.gz
linux-3.10-13be0c17d490290ff5222e3000c1738a8c845333.tar.bz2
linux-3.10-13be0c17d490290ff5222e3000c1738a8c845333.zip
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 <jason.hrycay@motorola.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/xattr.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 0b02dce3135..ae61f359554 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) {