mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Eric Paris <eparis@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] inotify: race use after free/double free in inotify inode marks
Date: Wed, 12 May 2010 20:16:31 -0400	[thread overview]
Message-ID: <20100512201631.a6955325.akpm@linux-foundation.org> (raw)
In-Reply-To: <1273680480-2550-1-git-send-email-eparis@redhat.com>

On Wed, 12 May 2010 12:08:00 -0400 Eric Paris <eparis@redhat.com> wrote:

> From: root <root@tyan-gt24-04.rhts.eng.bos.redhat.com>

hm.

> There is a race in the inotify add/rm watch code.  A task can find and
> remove a mark which doesn't have all of it's references.  This can
> result in a use after free/double free situation.
> 
> Task A					Task B
> ------------				-----------
> inotify_new_watch()
>  allocate a mark (refcnt == 1)
>  add it to the idr
> 					inotify_rm_watch()
> 					 inotify_remove_from_idr()
> 					  fsnotify_put_mark()
> 					      refcnt hits 0, free
>  take reference because we are on idr
>  [at this point it is a use after free]
>  [time goes on]
>  refcnt may hit 0 again, double free
> 
> The fix is to take the reference BEFORE the object can be found in the
> idr.
> 
> Signed-off-by: Eric Paris <eparis@redhat.com>

The changelog has no "Cc: <stable@kernel.org>".  I suspect it should
have that?


  reply	other threads:[~2010-05-13  3:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-12 16:08 Eric Paris
2010-05-13  0:16 ` Andrew Morton [this message]
2010-05-13 11:31   ` Eric Paris

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=20100512201631.a6955325.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=eparis@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome