audit_get_nd(): don't unlock parent too early
[linux-2.6-block.git] / kernel / audit_watch.c
index 1f31c2f1e6fc19ad9eecc957d7f2cb9a6154a032..4508d5e0cf6966b89ac1f59bd3348b93c833e757 100644 (file)
@@ -351,12 +351,12 @@ static int audit_get_nd(struct audit_watch *watch, struct path *parent)
        struct dentry *d = kern_path_locked(watch->path, parent);
        if (IS_ERR(d))
                return PTR_ERR(d);
-       inode_unlock(d_backing_inode(parent->dentry));
        if (d_is_positive(d)) {
                /* update watch filter fields */
                watch->dev = d->d_sb->s_dev;
                watch->ino = d_backing_inode(d)->i_ino;
        }
+       inode_unlock(d_backing_inode(parent->dentry));
        dput(d);
        return 0;
 }