On 8/11/20 5:46 AM, Eugeniu Rosca wrote: > Commit 52f23478081ae0 ("mm/slub.c: fix corrupted freechain in > deactivate_slab()") suffered an update when picked up from LKML [1]. > > Specifically, relocating 'freelist = NULL' into 'freelist_corrupted()' > created a no-op statement. Fix it by sticking to the behavior intended > in the original patch [1]. Prefer the lowest-line-count solution. > > [1] https://lore.kernel.org/linux-mm/20200331031450.12182-1-dongli.zhang@xxxxxxxxxx/ > > Fixes: 52f23478081ae0 ("mm/slub.c: fix corrupted freechain in deactivate_slab()") > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> > Cc: Dongli Zhang <dongli.zhang@xxxxxxxxxx> > Cc: <stable@xxxxxxxxxxxxxxx> > Signed-off-by: Eugeniu Rosca <erosca@xxxxxxxxxxxxxx> > --- > mm/slub.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/mm/slub.c b/mm/slub.c > index 68c02b2eecd9..9a3e963b02a3 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -677,7 +677,6 @@ static bool freelist_corrupted(struct kmem_cache *s, struct page *page, > if ((s->flags & SLAB_CONSISTENCY_CHECKS) && > !check_valid_pointer(s, page, nextfree)) { > object_err(s, page, freelist, "Freechain corrupt"); > - freelist = NULL; > slab_fix(s, "Isolate corrupted freechain"); > return true; > } > @@ -2184,8 +2183,10 @@ static void deactivate_slab(struct kmem_cache *s, struct page *page, > * 'freelist' is already corrupted. So isolate all objects > * starting at 'freelist'. > */ > - if (freelist_corrupted(s, page, freelist, nextfree)) > + if (freelist_corrupted(s, page, freelist, nextfree)) { > + freelist = NULL; This is good to me. However, this would confuse people when CONFIG_SLUB_DEBUG is not defined. While reading the source code, people may be curious why to reset freelist when CONFIG_SLUB_DEBUG is even not defined. Dongli Zhang