diff options
author | Jason Hrycay <jhrycay@gmail.com> | 2013-05-31 13:45:11 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-06-03 06:49:09 -0400 |
commit | 1e03e38b35b8e72d65fd5d931627bd6ff02926c1 (patch) | |
tree | e8da576270efe341f63e1e5bd2cc033631dc84cf /fs/f2fs | |
parent | 83d5d6f66b375f21bee4c2e17178f7c073a66301 (diff) |
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.c | 4 |
1 files changed, 4 insertions, 0 deletions
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, | |||
218 | return -ENODATA; | 218 | return -ENODATA; |
219 | 219 | ||
220 | page = get_node_page(sbi, fi->i_xattr_nid); | 220 | page = get_node_page(sbi, fi->i_xattr_nid); |
221 | if (IS_ERR(page)) | ||
222 | return PTR_ERR(page); | ||
221 | base_addr = page_address(page); | 223 | base_addr = page_address(page); |
222 | 224 | ||
223 | list_for_each_xattr(entry, base_addr) { | 225 | list_for_each_xattr(entry, base_addr) { |
@@ -268,6 +270,8 @@ ssize_t f2fs_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size) | |||
268 | return 0; | 270 | return 0; |
269 | 271 | ||
270 | page = get_node_page(sbi, fi->i_xattr_nid); | 272 | page = get_node_page(sbi, fi->i_xattr_nid); |
273 | if (IS_ERR(page)) | ||
274 | return PTR_ERR(page); | ||
271 | base_addr = page_address(page); | 275 | base_addr = page_address(page); |
272 | 276 | ||
273 | list_for_each_xattr(entry, base_addr) { | 277 | list_for_each_xattr(entry, base_addr) { |