[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1273750308.2772.18.camel@localhost>
Date: Thu, 13 May 2010 07:31:48 -0400
From: Eric Paris <eparis@...hat.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] inotify: race use after free/double free in inotify
inode marks
On Wed, 2010-05-12 at 20:16 -0400, Andrew Morton wrote:
> On Wed, 12 May 2010 12:08:00 -0400 Eric Paris <eparis@...hat.com> wrote:
>
> > From: root <root@...n-gt24-04.rhts.eng.bos.redhat.com>
>
> hm.
Well poop. That's what I get for using git on a random test box. I
moved it to my real tree with git-format-patch > git-am. I'll fix the
author.
> > 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@...hat.com>
>
> The changelog has no "Cc: <stable@...nel.org>". I suspect it should
> have that?
Will fix before I ask Linus to pull....
-Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists