[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJfpegt8JS-9LsRhmw9W2VMNG+tc+gGNsSwy1ULLoSFeYpHueA@mail.gmail.com>
Date: Fri, 21 May 2021 10:23:47 +0200
From: Miklos Szeredi <miklos@...redi.hu>
To: Greg Kurz <groug@...d.org>
Cc: Al Viro <viro@...iv.linux.org.uk>,
virtualization@...ts.linux-foundation.org,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
virtio-fs-list <virtio-fs@...hat.com>,
Stefan Hajnoczi <stefanha@...hat.com>,
Max Reitz <mreitz@...hat.com>, Vivek Goyal <vgoyal@...hat.com>
Subject: Re: [PATCH v4 1/5] fuse: Fix leak in fuse_dentry_automount() error path
On Fri, 21 May 2021 at 10:15, Greg Kurz <groug@...d.org> wrote:
>
> On Fri, 21 May 2021 09:54:19 +0200
> Miklos Szeredi <miklos@...redi.hu> wrote:
>
> > On Thu, 20 May 2021 at 21:45, Al Viro <viro@...iv.linux.org.uk> wrote:
> > >
> > > On Thu, May 20, 2021 at 05:46:50PM +0200, Greg Kurz wrote:
> > > > Some rollback was forgotten during the addition of crossmounts.
> > >
> > > Have you actually tested that? Because I strongly suspect that
> > > by that point the ownership of fc and fm is with sb and those
> > > should be taken care of by deactivate_locked_super().
> >
> > Not quite. Patch looks correct because destruction of fm is done in
> > fuse_put_super(), which only gets called if the sb initialization gets
> > as far as setting up sb->s_root, which only happens after the
> > successful fuse_fill_super_submount() call in this case.
> >
> > Doing the destruction from the various ->kill_sb() instances instead
> > of from ->put_super() would also fix this, but I'm not quite sure that
> > that would be any cleaner.
> >
>
> As saying in the answer I've just posted, a failure in
> fuse_fill_super_submount() causes an actual crash because
> fuse_mount_remove() logically assumes fm to already be in
> fc->mounts, which isn't the case at this point.
>
> In the root mount case, this is handled by taking back
> the ownership on fm, i.e. do the rollback *and* clear
> sb->s_fs_info. It seems that the same should be done
> for submounts.
Agreed. Thanks for verifying.
Miklos
Powered by blists - more mailing lists