All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Kees Cook <keescook@chromium.org>
Cc: James Morris <jmorris@namei.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] securityfs: Add missing d_delete() call on removal
Date: Wed, 6 May 2020 19:49:20 +0100	[thread overview]
Message-ID: <20200506184920.GD23230@ZenIV.linux.org.uk> (raw)
In-Reply-To: <202005060831.C05759E@keescook>

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().

  reply	other threads:[~2020-05-06 18:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 23:40 [PATCH] securityfs: Add missing d_delete() call on removal Kees Cook
2020-05-06  1:14 ` Al Viro
2020-05-06  3:28   ` Kees Cook
2020-05-06  4:02     ` Al Viro
2020-05-06 15:34       ` Kees Cook
2020-05-06 18:49         ` Al Viro [this message]
2020-05-06 22:49           ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200506184920.GD23230@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=jmorris@namei.org \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=serge@hallyn.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.