Re: [PATCH] mm,vmscan: Mark register_shrinker() as __must_check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew Morton wrote:
> On Tue, 21 Nov 2017 21:02:37 +0900 Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote:
> 
> > There are users not checking for register_shrinker() failure.
> > Continuing with ignoring failure can lead to later oops at
> > unregister_shrinker().
> > 
> > ...
> >
> > --- a/include/linux/shrinker.h
> > +++ b/include/linux/shrinker.h
> > @@ -75,6 +75,6 @@ struct shrinker {
> >  #define SHRINKER_NUMA_AWARE	(1 << 0)
> >  #define SHRINKER_MEMCG_AWARE	(1 << 1)
> >  
> > -extern int register_shrinker(struct shrinker *);
> > +extern __must_check int register_shrinker(struct shrinker *);
> >  extern void unregister_shrinker(struct shrinker *);
> >  #endif
> 
> hm, well, OK, it's a small kmalloc(GFP_KERNEL).  That won't be
> failing.

It failed by fault injection and resulted in a report at
http://lkml.kernel.org/r/001a113f996099503a055e793dd3@xxxxxxxxxx .

> 
> Affected code seems to be fs/xfs, fs/super.c, fs/quota,
> arch/x86/kvm/mmu, drivers/gpu/drm/ttm, drivers/md and a bunch of
> staging stuff.
> 
> I'm not sure this is worth bothering about?
> 

Continuing with failed register_shrinker() is almost always wrong.
Though I don't know whether mm/zsmalloc.c case can make sense.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux