Skip to contentSkip to conversation

f2fs: handle errors from get_node_page calls

PATCH Jason Hrycay 1 participant 1 message May 31, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Add check for error pointers returned from get_node_page in order to avoid dereferencing a bad address on the next use.

---
 fs/f2fs/xattr.c | 4 ++++
 1 file changed, 4 insertions(+)
fs/f2fs/xattr.c +0 -0
index 0b02dce..ae61f35 100644
@@ -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) {

Signature · 1 line
1.8.0