History

apparmor: delete the dentry in aafs_remove() to avoid a leak

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.

Chris Coulson committed 7 years ago

Commit 201218e1 parent 43aa09f1 file · +1 −0Browse files

Unified · Split

security/apparmor/apparmorfs.c+1−0
@@ -356,6 +356,7 @@ static void aafs_remove(struct dentry *dentry) · 355 unmodified lines
356 simple_rmdir(dir, dentry);356 simple_rmdir(dir, dentry);
357 else357 else
358 simple_unlink(dir, dentry);358 simple_unlink(dir, dentry);
359 d_delete(dentry);
359 dput(dentry);360 dput(dentry);
360 }361 }
361 inode_unlock(dir);362 inode_unlock(dir);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t