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

index 82e85b2623435693a3d5fece7774d596fa0d9f70..8bbe15975975cc19839f35f73a43233721f6c43a 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 fce2a3b61595af3856ccd2bc63a9d47eca13fa26..b9b8b0608785f127b2092735e527c7687006c68a 100644 (file)
@@ -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) {