From 5c3a1c16a6f3bc49a5962b977ad8b0af84cef01d Mon Sep 17 00:00:00 2001 From: Erez Zadok Date: Fri, 28 Dec 2007 13:46:24 -0500 Subject: [PATCH] Unionfs: handle on lower inodes in lookup Signed-off-by: Erez Zadok --- fs/unionfs/dentry.c | 6 +++++- fs/unionfs/lookup.c | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fs/unionfs/dentry.c b/fs/unionfs/dentry.c index 82e85b26234..8bbe1597597 100644 --- a/fs/unionfs/dentry.c +++ b/fs/unionfs/dentry.c @@ -144,8 +144,12 @@ static bool __unionfs_d_revalidate_one(struct dentry *dentry, valid = false; } - if (!dentry->d_inode) + if (!dentry->d_inode || + ibstart(dentry->d_inode) < 0 || + ibend(dentry->d_inode) < 0) { valid = false; + goto out; + } if (valid) { /* diff --git a/fs/unionfs/lookup.c b/fs/unionfs/lookup.c index fce2a3b6159..b9b8b060878 100644 --- a/fs/unionfs/lookup.c +++ b/fs/unionfs/lookup.c @@ -230,6 +230,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry, /* FIXME: fix following line for mount point crossing */ nd->mnt = unionfs_lower_mnt_idx(parent_dentry, bindex); } + BUG_ON(!lower_dir_dentry); lower_dentry = lookup_one_len_nd((char *) name, lower_dir_dentry, namelen, nd); if (IS_ERR(lower_dentry)) { @@ -321,6 +322,10 @@ out_negative: UNIONFS_I(dentry->d_inode)->stale = 1; goto out; } + if (!lower_dir_dentry) { + err = -ENOENT; + goto out; + } /* This should only happen if we found a whiteout. */ if (first_dentry_offset == -1) { if (nd) { -- 2.43.0