linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* f2fs: handle errors from get_node_page calls
@ 2013-05-31 17:45 Jason Hrycay
  0 siblings, 0 replies; only message in thread
From: Jason Hrycay @ 2013-05-31 17:45 UTC (permalink / raw)
  Cc: linux-fsdevel, linux-kernel, linux-f2fs-devel, jaegeuk.kim,
	jason.hrycay, C.Fries

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>
---
 fs/f2fs/xattr.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 0b02dce..ae61f35 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) {
-- 
1.8.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-05-31 17:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-31 17:45 f2fs: handle errors from get_node_page calls Jason Hrycay

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).