Merge branch 'work.lookup' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[muen/linux.git] / fs / proc / base.c
index 44dec22e5e9e61e2f6b90befec5a5355ac6676f9..8358c5330c0b1abd8530c583b75af33b47a74889 100644 (file)
@@ -1866,19 +1866,19 @@ bool proc_fill_cache(struct file *file, struct dir_context *ctx,
                        struct dentry *res;
                        res = instantiate(child, task, ptr);
                        d_lookup_done(child);
-                       if (IS_ERR(res))
-                               goto end_instantiate;
                        if (unlikely(res)) {
                                dput(child);
                                child = res;
+                               if (IS_ERR(child))
+                                       goto end_instantiate;
                        }
                }
        }
        inode = d_inode(child);
        ino = inode->i_ino;
        type = inode->i_mode >> 12;
-end_instantiate:
        dput(child);
+end_instantiate:
        return dir_emit(ctx, name, len, ino, type);
 }