Unionfs: handle on lower inodes in lookup
authorErez Zadok <ezk@cs.sunysb.edu>
Fri, 28 Dec 2007 18:46:17 +0000 (13:46 -0500)
committerErez Zadok <ezk@cs.sunysb.edu>
Sun, 23 Mar 2008 03:49:16 +0000 (23:49 -0400)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/dentry.c
fs/unionfs/lookup.c

index a2ee52cac3734872d89a370ff56523136a2e2fc9..3dd61202f862d9614f84f927dd6335bcdd2b478a 100644 (file)
@@ -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) {
                /*
index d13b17a1bad7c19a9fc499dbe98bf55acfe2f49a..377f9d053f324904731d10644c5df8c70c5c5842 100644 (file)
@@ -229,6 +229,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(name, lower_dir_dentry,
                                                 namelen, nd);
                if (IS_ERR(lower_dentry)) {
@@ -320,6 +321,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) {
                nd->dentry = dentry;