linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Miklos Szeredi <miklos@szeredi.hu>,
	Eric Paris <eparis@redhat.com>,
	akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH resend] audit: fix mark refcounting
Date: Thu, 15 Dec 2011 08:48:30 -0800	[thread overview]
Message-ID: <CA+55aFxsFDbnD2om1TWHJiqCEwnWKpw2d1jNU+K_GgaSStiDfw@mail.gmail.com> (raw)
In-Reply-To: <20111215084050.GQ2203@ZenIV.linux.org.uk>

On Thu, Dec 15, 2011 at 12:40 AM, Al Viro <viro@zeniv.linux.org.uk> wrote:
>>
>> In particular, a quick grep shows that there are destroy_mark users still in:
>>
>>  - fs/notify/fanotify/fanotify_user.c
>>
>>  - fs/notify/dnotify/dnotify.c (2 of them)
>>
>>  - fs/notify/inotify/inotify_fsnotify.c
>>
>> that don't do "put_mark()" after the destroy. Why is it ok there?
>
> Um?  dnotify has fsnotify_put_mark() called in both cases...

Ok, that didn't show up in my grep, the "put_mark()" was more than
three lines away in the other case. As mentioned, I simply grepped
without looking at much context at all.

> I don't like it; it's called from ->handle_event() and parent->mark is
> exactly the inode_mark argument of that method.  It ought to be pinned
> by caller.  In other places we *do* need get/put around that destroy
> and we generally do that.

Presumably *parent* is pinned by caller, but not ->mark. So when the
parent directory is deleted, the parent data structure stays around,
but mark is cleanred, and you get the oops that was reported. See the
simple two-liner example to trigger it. I didn't test it myself, but
it looks obvious.

                             Linus

  parent reply	other threads:[~2011-12-15 16:48 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-07 14:59 [PATCH] audit: fix mark refcounting Miklos Szeredi
2011-11-15 14:12 ` Miklos Szeredi
2011-11-15 14:31   ` Eric Paris
2011-12-14 14:35 ` [PATCH resend] " Miklos Szeredi
2011-12-15  2:15   ` Linus Torvalds
2011-12-15  8:40     ` Al Viro
2011-12-15  8:56       ` Miklos Szeredi
2011-12-15  9:01         ` Al Viro
2011-12-15  9:03         ` Miklos Szeredi
2011-12-15 20:06           ` Lino Sanfilippo
2011-12-15 22:28             ` Eric Paris
2011-12-15 22:34               ` Linus Torvalds
2011-12-15 22:55             ` Al Viro
2012-01-12 16:59               ` Miklos Szeredi
2011-12-15 16:48       ` Linus Torvalds [this message]
2011-12-15  8:49     ` Miklos Szeredi

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=CA+55aFxsFDbnD2om1TWHJiqCEwnWKpw2d1jNU+K_GgaSStiDfw@mail.gmail.com \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=eparis@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).