From patchwork Tue Aug 11 12:46:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniu Rosca X-Patchwork-Id: 11709223 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1FDB013B1 for ; Tue, 11 Aug 2020 12:47:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EA57E206C3 for ; Tue, 11 Aug 2020 12:47:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA57E206C3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=de.adit-jv.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B98E16B0005; Tue, 11 Aug 2020 08:47:22 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id B49336B0006; Tue, 11 Aug 2020 08:47:22 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5F216B0007; Tue, 11 Aug 2020 08:47:22 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0093.hostedemail.com [216.40.44.93]) by kanga.kvack.org (Postfix) with ESMTP id 8FE296B0005 for ; Tue, 11 Aug 2020 08:47:22 -0400 (EDT) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 1EA67181AEF10 for ; Tue, 11 Aug 2020 12:47:22 +0000 (UTC) X-FDA: 77138263524.23.spot49_2907a4826fe3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin23.hostedemail.com (Postfix) with ESMTP id D689C37606 for ; Tue, 11 Aug 2020 12:47:21 +0000 (UTC) X-Spam-Summary: 80,0,0,deabc5bc151d98c4,d41d8cd98f00b204,erosca@de.adit-jv.com,,RULES_HIT:41:355:379:541:582:800:960:965:966:967:973:988:989:1152:1260:1261:1277:1311:1313:1314:1345:1431:1437:1515:1516:1518:1534:1541:1711:1730:1747:1777:1792:2196:2199:2393:2525:2559:2563:2682:2685:2859:2895:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3352:3865:3867:3870:3871:3872:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4321:4385:4390:4395:4470:5007:6117:6261:7903:7974:9025:10004:10400:11026:11658:11914:12043:12114:12296:12297:12438:12517:12519:12521:12555:12679:12895:12986:13069:13311:13357:13894:14096:14097:14181:14394:14721:21063:21080:21325:21451:21627:21749:21811:21990:30054:30064:30070,0,RBL:93.241.18.167:@de.adit-jv.com:.lbl8.mailshell.net-62.14.6.180 64.201.201.201;04y8do1oatqp5rxs69hkcdph6ggfdopwedtzpjsotxzzrejteien9q67nckyjaf.xoxromi38emjdmmh4dpaczoijzqkup4ym4r97ut91j6etqjbdjkitmjrjbfikfw.1-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0. 5,0.5,0. X-HE-Tag: spot49_2907a4826fe3 X-Filterd-Recvd-Size: 3219 Received: from smtp1.de.adit-jv.com (smtp1.de.adit-jv.com [93.241.18.167]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Tue, 11 Aug 2020 12:47:20 +0000 (UTC) Received: from localhost (smtp1.de.adit-jv.com [127.0.0.1]) by smtp1.de.adit-jv.com (Postfix) with ESMTP id B549F3C0579; Tue, 11 Aug 2020 14:47:18 +0200 (CEST) Received: from smtp1.de.adit-jv.com ([127.0.0.1]) by localhost (smtp1.de.adit-jv.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BXIy4wo0d5QG; Tue, 11 Aug 2020 14:47:13 +0200 (CEST) Received: from HI2EXCH01.adit-jv.com (hi2exch01.adit-jv.com [10.72.92.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp1.de.adit-jv.com (Postfix) with ESMTPS id 01C963C009D; Tue, 11 Aug 2020 14:47:09 +0200 (CEST) Received: from lxhi-065.adit-jv.com (10.72.94.12) by HI2EXCH01.adit-jv.com (10.72.92.24) with Microsoft SMTP Server (TLS) id 14.3.487.0; Tue, 11 Aug 2020 14:47:08 +0200 From: Eugeniu Rosca To: Andrew Morton , Dongli Zhang CC: , , Eugeniu Rosca , Eugeniu Rosca Subject: [PATCH] mm: slub: fix conversion of freelist_corrupted() Date: Tue, 11 Aug 2020 14:46:56 +0200 Message-ID: <20200811124656.10308-1-erosca@de.adit-jv.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Originating-IP: [10.72.94.12] X-Rspamd-Queue-Id: D689C37606 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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@oracle.com/ Fixes: 52f23478081ae0 ("mm/slub.c: fix corrupted freechain in deactivate_slab()") Cc: Andrew Morton Cc: Dongli Zhang Cc: Signed-off-by: Eugeniu Rosca --- 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; break; + } do { prior = page->freelist;