[Intel-gfx] [PATCH 2/2] i915: do not leak module ref counter

Chris Wilson chris at chris-wilson.co.uk
Fri Aug 2 13:10:18 UTC 2019


Quoting Chris Wilson (2019-08-02 13:58:36)
> Quoting Sergey Senozhatsky (2019-08-02 13:39:56)
> > put_filesystem() before i915_gemfs_init() deals with
> > kern_mount() error.
> > 
> > Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky at gmail.com>
> > ---
> >  drivers/gpu/drm/i915/gem/i915_gemfs.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/gem/i915_gemfs.c b/drivers/gpu/drm/i915/gem/i915_gemfs.c
> > index cf05ba72df9d..d437188d1736 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gemfs.c
> > +++ b/drivers/gpu/drm/i915/gem/i915_gemfs.c
> > @@ -24,8 +24,10 @@ int i915_gemfs_init(struct drm_i915_private *i915)
> >                 return -ENODEV;
> >  
> >         gemfs = kern_mount(type);
> 
> Looking around, it looks like we always need to drop type after
> mounting. Should the
>         put_filesystem(type);
> be here instead?
> 
> Anyway, nice catch.

Sigh. put_filesystem() is part of fs internals. I'd be tempted to add

static void put_filesystem(struct file_system_type *fs)
{
	module_put(fs->owner);
}

and cc that for stable. And send a patch to add EXPORT_SYMBOL and queue
it for removal. Or just ignore the stable@ since it's unlikely to be
ever met in the wild and just request the EXPORT_SYMBOL.
-Chris


More information about the Intel-gfx mailing list