From patchwork Sat Sep 12 16:23:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 264019 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 54F7BC433E2 for ; Sat, 12 Sep 2020 16:24:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15BFA21D91 for ; Sat, 12 Sep 2020 16:24:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599927841; bh=kwP53eH5IqCxm9HudNRxwpgr+1zS/nqL+D0AXpaGH7A=; h=Date:From:To:Subject:List-ID:From; b=kj720Uvo0ftthSdbYKENfuV4cJHgJLP7NXabrspGJHk2/psouKqr27IUERF4pjr1L +ZwZfJ8jw6kLS2Kq2aVTB49dNdAliJNYKSOS63d14rYxfdJDuE2eXZhjTymQH8T+wp 2sTSdQDx9H5R7XpnCtTF7U6FpCAbuHT851DUzACY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725860AbgILQXo (ORCPT ); Sat, 12 Sep 2020 12:23:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:59458 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725863AbgILQXi (ORCPT ); Sat, 12 Sep 2020 12:23:38 -0400 Received: from localhost.localdomain (c-71-198-47-131.hsd1.ca.comcast.net [71.198.47.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9148121655; Sat, 12 Sep 2020 16:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599927817; bh=kwP53eH5IqCxm9HudNRxwpgr+1zS/nqL+D0AXpaGH7A=; h=Date:From:To:Subject:From; b=iNENi7+MWvPdSrq0K9lxYNjwct5an2djn9jN/jv9q8pcS2jSannV12Bt8XRbiWjRi +Dg+7u8O/Inb5+uCgH1jbcV/vtNTAkAoG/dUj5Ho6IuIvxRT0Ersuz1WfjeCxdRUe5 TKo5sNScfJJFhdfB+/BdUXhQySYeszcP/mvRnhb0= Date: Sat, 12 Sep 2020 09:23:37 -0700 From: akpm@linux-foundation.org To: cl@linux.com, dongli.zhang@oracle.com, erosca@de.adit-jv.com, iamjoonsoo.kim@lge.com, joe.jin@oracle.com, mm-commits@vger.kernel.org, penberg@kernel.org, rientjes@google.com, stable@vger.kernel.org Subject: [merged] mm-slub-fix-conversion-of-freelist_corrupted.patch removed from -mm tree Message-ID: <20200912162337.1a6lzB3j8%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch titled Subject: mm: slub: fix conversion of freelist_corrupted() has been removed from the -mm tree. Its filename was mm-slub-fix-conversion-of-freelist_corrupted.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ From: Eugeniu Rosca Subject: mm: slub: fix conversion of freelist_corrupted() 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]. In addition, make freelist_corrupted() immune to passing NULL instead of &freelist. The issue has been spotted via static analysis and code review. [1] https://lore.kernel.org/linux-mm/20200331031450.12182-1-dongli.zhang@oracle.com/ Link: https://lkml.kernel.org/r/20200824130643.10291-1-erosca@de.adit-jv.com Fixes: 52f23478081ae0 ("mm/slub.c: fix corrupted freechain in deactivate_slab()") Signed-off-by: Eugeniu Rosca Cc: Dongli Zhang Cc: Joe Jin Cc: Christoph Lameter Cc: Pekka Enberg Cc: David Rientjes Cc: Joonsoo Kim Cc: Signed-off-by: Andrew Morton --- mm/slub.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/mm/slub.c~mm-slub-fix-conversion-of-freelist_corrupted +++ a/mm/slub.c @@ -672,12 +672,12 @@ static void slab_fix(struct kmem_cache * } static bool freelist_corrupted(struct kmem_cache *s, struct page *page, - void *freelist, void *nextfree) + void **freelist, void *nextfree) { if ((s->flags & SLAB_CONSISTENCY_CHECKS) && - !check_valid_pointer(s, page, nextfree)) { - object_err(s, page, freelist, "Freechain corrupt"); - freelist = NULL; + !check_valid_pointer(s, page, nextfree) && freelist) { + object_err(s, page, *freelist, "Freechain corrupt"); + *freelist = NULL; slab_fix(s, "Isolate corrupted freechain"); return true; } @@ -1494,7 +1494,7 @@ static inline void dec_slabs_node(struct int objects) {} static bool freelist_corrupted(struct kmem_cache *s, struct page *page, - void *freelist, void *nextfree) + void **freelist, void *nextfree) { return false; } @@ -2184,7 +2184,7 @@ static void deactivate_slab(struct kmem_ * '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)) break; do {