[PATCH] securityfs: Add missing d_delete() call on removal
Al Viro
viro at zeniv.linux.org.uk
Wed May 6 18:49:20 UTC 2020
On Wed, May 06, 2020 at 08:34:29AM -0700, Kees Cook wrote:
> Just posted the whole series:
> https://lore.kernel.org/lkml/20200506152114.50375-1-keescook@chromium.org/
>
> But the specific question was driven by this patch:
> https://lore.kernel.org/lkml/20200506152114.50375-11-keescook@chromium.org/
Yecchh... First of all, you are leaving a dangling pointer in your
struct pstore_private ->dentry. What's more, in your case d_delete()
is definitely wrong - either there are other references to dentry
(in which case d_delete() is the same as d_drop()), or dput() right
after it will drive ->d_count to zero and since you end up using
simple_dentry_operations, dentry will be freed immediately after
that.
I have not looked at the locking in that series yet, so no comments
on the races, but in any case - that d_delete() is a misspelled d_drop().
More information about the Linux-security-module-archive
mailing list