Unionfs: don't dereference dentry without lower branches in d_release
authorErez Zadok <ezk@cs.sunysb.edu>
Tue, 15 Apr 2008 17:07:44 +0000 (13:07 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Fri, 12 Aug 2011 02:38:08 +0000 (22:38 -0400)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/dentry.c

index ee0da4f45e9019cb085a6aec33abdd8e69ba590e..e5f894cd93763c5f0b3566a64006693934e28231 100644 (file)
@@ -482,12 +482,14 @@ static void unionfs_d_release(struct dentry *dentry)
        int bindex, bstart, bend;
 
        unionfs_read_lock(dentry->d_sb, UNIONFS_SMUTEX_CHILD);
+       if (unlikely(!UNIONFS_D(dentry)))
+               goto out;       /* skip if no lower branches */
        /* must lock our branch configuration here */
        unionfs_lock_dentry(dentry, UNIONFS_DMUTEX_CHILD);
 
        unionfs_check_dentry(dentry);
        /* this could be a negative dentry, so check first */
-       if (unlikely(!UNIONFS_D(dentry) || dbstart(dentry) < 0)) {
+       if (dbstart(dentry) < 0) {
                unionfs_unlock_dentry(dentry);
                goto out;       /* due to a (normal) failed lookup */
        }