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

index 374750e1e2d789f957d31ada6da19e3f08b544ee..cb77c07f58fe28cda2a69bb030f544212ef70177 100644 (file)
@@ -474,12 +474,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 */
        }