[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1338322067-17566-4-git-send-email-jack@suse.cz>
Date: Tue, 29 May 2012 22:07:46 +0200
From: Jan Kara <jack@...e.cz>
To: Al Viro <viro@...IV.linux.org.uk>
Cc: Ted Tso <tytso@....edu>, linux-ext4@...r.kernel.org,
linux-fsdevel@...r.kernel.org, Jan Kara <jack@...e.cz>
Subject: [PATCH 3/4] ext3: Handle error from d_splice_alias()
When directory hiearchy is corrupted and contains cycles, d_splice_alias() can
fail. Handle the failure cleanly.
Signed-off-by: Jan Kara <jack@...e.cz>
---
fs/ext3/namei.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index eeb63df..faf09b7 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1016,6 +1016,7 @@ static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, str
struct inode * inode;
struct ext3_dir_entry_2 * de;
struct buffer_head * bh;
+ struct dentry *ret;
if (dentry->d_name.len > EXT3_NAME_LEN)
return ERR_PTR(-ENAMETOOLONG);
@@ -1038,7 +1039,13 @@ static struct dentry *ext3_lookup(struct inode * dir, struct dentry *dentry, str
return ERR_PTR(-EIO);
}
}
- return d_splice_alias(inode, dentry);
+ ret = d_splice_alias(inode, dentry);
+ if (IS_ERR(ret)) {
+ ext3_error(dir->i_sb, __func__, "directory #%lu corrupted",
+ dir->i_ino);
+ iput(inode);
+ }
+ return ret;
}
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists