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

index b207a6fd02d0acc50d731254982cba7ada5257be..0e893085efec6dd79fcd4bd1c31ae34ffba2b341 100644 (file)
@@ -151,8 +151,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 85a85aaf8678801e7af80bc615a1438ccb3edbd2..b9ee072c52d9cdebc7f05079c6323389463d8352 100644 (file)
@@ -225,6 +225,7 @@ struct dentry *unionfs_lookup_backend(struct dentry *dentry,
                wh_lower_dentry = NULL;
 
                /* Now do regular lookup; lookup foo */
+               BUG_ON(!lower_dir_dentry);
                lower_dentry = lookup_one_len(name, lower_dir_dentry, namelen);
                if (IS_ERR(lower_dentry)) {
                        dput(first_lower_dentry);
@@ -315,6 +316,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) {
                first_lower_dentry = lookup_one_len(name, lower_dir_dentry,