]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - fs/ecryptfs/inode.c
eCryptfs: Prevent lower dentry from going negative during unlink
[karo-tx-linux.git] / fs / ecryptfs / inode.c
index 2f0945d632970511ba189a0ef8595e918c10b693..056fed62d0de8beb39f6a0ab6f195bb2577976e1 100644 (file)
@@ -476,6 +476,7 @@ static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry)
        struct inode *lower_dir_inode = ecryptfs_inode_to_lower(dir);
        struct dentry *lower_dir_dentry;
 
+       dget(lower_dentry);
        lower_dir_dentry = lock_parent(lower_dentry);
        rc = vfs_unlink(lower_dir_inode, lower_dentry);
        if (rc) {
@@ -489,6 +490,7 @@ static int ecryptfs_unlink(struct inode *dir, struct dentry *dentry)
        d_drop(dentry);
 out_unlock:
        unlock_dir(lower_dir_dentry);
+       dput(lower_dentry);
        return rc;
 }