summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorChris Coulson <chris.coulson@canonical.com>2019-02-04 10:21:23 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-05 15:38:01 +0100
commit01dbfb2c74e7f38f225153c156065c7011754c6e (patch)
tree92e13bf9aabb3d881204f7aea34fd3f63a07568b /security
parent2f27946e2af3d70a72937af1a34d12863f39db50 (diff)
apparmor: delete the dentry in aafs_remove() to avoid a leak
[ Upstream commit 201218e4d3dfa1346e30997f48725acce3f26d01 ] Although the apparmorfs dentries are always dropped from the dentry cache when the usage count drops to zero, there is no guarantee that this will happen in aafs_remove(), as another thread might still be using it. In this scenario, this means that the dentry will temporarily continue to appear in the results of lookups, even after the call to aafs_remove(). In the case of removal of a profile - it also causes simple_rmdir() on the profile directory to fail, as the directory won't be empty until the usage counts of all child dentries have decreased to zero. This results in the dentry for the profile directory leaking and appearing empty in the file system tree forever. Signed-off-by: Chris Coulson <chris.coulson@canonical.com> Signed-off-by: John Johansen <john.johansen@canonical.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'security')
-rw-r--r--security/apparmor/apparmorfs.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/security/apparmor/apparmorfs.c b/security/apparmor/apparmorfs.c
index dd746bd69a9b..c106988c1b25 100644
--- a/security/apparmor/apparmorfs.c
+++ b/security/apparmor/apparmorfs.c
@@ -363,6 +363,7 @@ static void aafs_remove(struct dentry *dentry)
simple_rmdir(dir, dentry);
else
simple_unlink(dir, dentry);
+ d_delete(dentry);
dput(dentry);
}
inode_unlock(dir);