2015-06-01 12:03:32

by Miklos Szeredi

[permalink] [raw]
Subject: Re: [PATCH] fuse: avoid clobbering fc->release with fuse_conn_init(fc)

On Mon, Jun 1, 2015 at 3:31 AM, Jeremiah Mahler <[email protected]> wrote:
> fuse_conn_init(fc) zeros the entire fc structure before it assigns
> specific values. Since fc->release is set before fuse_conn_init(fc)
> is called, the value gets set to zero, which results in a NULL pointer
> deference when fc->release() is called. Fix the problem by assigning
> fc->release after calling fuse_conn_init(fc) instead of before.

I added this fix to the original patch and force pushed to
fuse.git/for-next. Better keep it in one so that your fix is not left
out accidentally when being backported to -stable.

Thanks,
Miklos


>
> Signed-off-by: Jeremiah Mahler <[email protected]>
> Fixes: daccc092d1a2 ("fuse: initialize fc->release before calling it")
> ---
> fs/fuse/inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index 01ff55d..2913db2 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -1076,8 +1076,8 @@ static int fuse_fill_super(struct super_block *sb, void *data, int silent)
> if (!fc)
> goto err_fput;
>
> - fc->release = fuse_free_conn;
> fuse_conn_init(fc);
> + fc->release = fuse_free_conn;
>
> fud = fuse_dev_alloc(fc);
> if (!fud)
> --
> 2.1.4
>


2015-06-01 17:28:54

by Jeremiah Mahler

[permalink] [raw]
Subject: Re: [PATCH] fuse: avoid clobbering fc->release with fuse_conn_init(fc)

Miklos,

On Mon, Jun 01, 2015 at 02:03:02PM +0200, Miklos Szeredi wrote:
> On Mon, Jun 1, 2015 at 3:31 AM, Jeremiah Mahler <[email protected]> wrote:
> > fuse_conn_init(fc) zeros the entire fc structure before it assigns
> > specific values. Since fc->release is set before fuse_conn_init(fc)
> > is called, the value gets set to zero, which results in a NULL pointer
> > deference when fc->release() is called. Fix the problem by assigning
> > fc->release after calling fuse_conn_init(fc) instead of before.
>
> I added this fix to the original patch and force pushed to
> fuse.git/for-next. Better keep it in one so that your fix is not left
> out accidentally when being backported to -stable.
>
> Thanks,
> Miklos
>

Good idea, thanks :-)

--
- Jeremiah Mahler