From patchwork Tue Nov 13 07:00:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yongkai Wu X-Patchwork-Id: 10679813 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 992181709 for ; Tue, 13 Nov 2018 07:00:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 854F729F6A for ; Tue, 13 Nov 2018 07:00:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 796D229F70; Tue, 13 Nov 2018 07:00:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5EDA729F72 for ; Tue, 13 Nov 2018 07:00:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2FC996B000A; Tue, 13 Nov 2018 02:00:22 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 2AB2C6B000C; Tue, 13 Nov 2018 02:00:22 -0500 (EST) 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 19D106B000D; Tue, 13 Nov 2018 02:00:22 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-it1-f199.google.com (mail-it1-f199.google.com [209.85.166.199]) by kanga.kvack.org (Postfix) with ESMTP id E55876B000A for ; Tue, 13 Nov 2018 02:00:21 -0500 (EST) Received: by mail-it1-f199.google.com with SMTP id h126-v6so3003797ita.1 for ; Mon, 12 Nov 2018 23:00:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:mime-version:from:date:message-id :subject:to:cc; bh=DyyUrXq71+I1Pt0+riGqjJobzVnPyTqYWO/H5Z1zQE4=; b=ZmZ71K8/iIGZpNTOdQKPanwTvEFA2gSSS7scOpdyoc0mjllkvUbj6DjB1NO4GhEimD uR8AA1PrmbjceCce25V5UDrNJ0b56HTb/jK0FSxyP3N3ALGArY7wQlsY8UqhcnEQkZfZ Iz3niS9tWAMhAp/0WNh4PpyosriX7L4GqvfZvWxRi8eJ7Uwe++Zm+D60gkKXo5EAJXSE 5MNBgWJFFzlPmofe3oI/zlnGk+yr31DW1hexUeb7dLt3wMv0VJ0oA072UgGvvluKsoWR Ps9jLiT7Gy1saLLISH6Kij61l45oOHVlJXqEnHuQULvIze9I1pD8FIwbxL/emkM4p9kE eA2Q== X-Gm-Message-State: AGRZ1gInwhFqSZ+qejnYfZ/URG4AClYaW0SXnjOQ1tCJKMbGwHukcjH7 s5rDVKdJrNKKMq2pQmhCV/2+v1iMcndiuvSl/XkTgJ0lXwLariSbY3klN/c2L5yayEGpWpVX4AF FGV+PGNT3N3ss4+ZSFYvfEffKKOcX759DTGgW/d2+tMG85afcYwpfrj2JfrA5NYAPjUKmHszrtJ lkC1Q5KXP6/pq7fDZiGEhkeHhM6s507HBcgRcNbWuP0fH3iW02Xg48OwiHB7YYpJmUClIgJ8PsA iQ0lqTX2WnHd0tksd25T4fgBKNk/ESjZSMDBhBnWey60QNiSXlB22dj8v1oHKYvipILbk7Rup8R fwPItO2Cy+QbRQagLRQLcU7T+oGugow1umur4zCdxRcYI+00hYXh8+ek8ThDhMcJSa+YIOxNY2v d X-Received: by 2002:a24:f601:: with SMTP id u1mr2145177ith.14.1542092421582; Mon, 12 Nov 2018 23:00:21 -0800 (PST) X-Received: by 2002:a24:f601:: with SMTP id u1mr2145133ith.14.1542092420561; Mon, 12 Nov 2018 23:00:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542092420; cv=none; d=google.com; s=arc-20160816; b=rIuyYr757CX7k+zetAF79Hwln/j5GaM9o7xNTeoM0tv14shot64j3uuMAv5CUeHAWF 1TqSigB0BJyYECMEs1h6fAaCaRY66Q2orwwxOSzz8WipO/VU7Myic51jMq/pbdQetcS2 FUwyPN3fzX2STxvs7iceXi8O+LLrGsrbzZ3RJ06ahO1WEq1sM1tNYntTNflB/fhqLDF3 82MEnSAEaiDUU/SFwVCHtxRUvlfg8fyT7IUpCdGwdzUcI7JOdyfNDt8vflv2FIIlZ+jQ frdXA2uWDH+XxrThcMriqj/6byT4GR9/wvlvbhOslBloMhmCBrjynPXac0J0Tosvr5YG ZeGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:mime-version:dkim-signature; bh=DyyUrXq71+I1Pt0+riGqjJobzVnPyTqYWO/H5Z1zQE4=; b=fPjBXpM0X75rN3H5070AazTZN8egOTM0Q2BTAC24AIPk92j8S1i4cK9G95jn7licJt bnSGf5Fv7VhKdx97mLkvCdPVgqxdYscBxJxb7VEOgBaCSXH3YyZZI3IERnOCzmPxJJ/7 /RMs79IT3QPl7Ls+MSr5AaUh+UaqjVcFhgrRQW+/wLNpKImUN3B9iBOCNXRZ7RTEaYMj pbHu+vkaJQtY/9akRfGG2kcUjFSRyov6ANtt9hquXFTGcQ0LIvj3kKXXzkCLxHyI1sUC aQVanjT2igSdUdcfmBh1DsEetWHeDlM/DAakXtQjE68ZWSF7+zCjURZARtKLFHlEUF+/ olug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EgQY1JeW; spf=pass (google.com: domain of nic.wuyk@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=nic.wuyk@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id 191-v6sor18570647itu.15.2018.11.12.23.00.20 for (Google Transport Security); Mon, 12 Nov 2018 23:00:20 -0800 (PST) Received-SPF: pass (google.com: domain of nic.wuyk@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EgQY1JeW; spf=pass (google.com: domain of nic.wuyk@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=nic.wuyk@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=DyyUrXq71+I1Pt0+riGqjJobzVnPyTqYWO/H5Z1zQE4=; b=EgQY1JeW4CQoOC2G/lOMlOo1PqIsPiSuUG7H0kvSYxQ3wz9rZwwfzfYqnFTs9go03B 95mW70TZ1m6ykiDK3WeJFQWNqR99E0qnUimXmmJ58RIIVqP/RLicTgTDq+0wjiBUTAqq pyAU8N7YtqvIUgZJv0AkxT9sK6waV3wN4neVVJNRp521XeKRsZtFFt5TI9CI2sJPShXI 4AiwqKgIK9g3yQTOgRAdAFpfbfFllPaSDKpwe7i+l9dyBxOM9bEksk/wp+3nySFqdPw1 YW3fNQBbYvV7DppPVdMxRaGTKGNyuLCBVi5vP97VV9SCE3UOM0i8KY+cHboDKabUFeqh 0V4Q== X-Google-Smtp-Source: AJdET5d10QOy1SqOsv4ji5YMYyGn/N3ogDKP/68wWO7+MzJbySzMQAzI0d/H7GPVQcAIdWIOKy/EYrEAP5yv+DsChhQ= X-Received: by 2002:a05:660c:88e:: with SMTP id o14mr2760699itk.44.1542092420278; Mon, 12 Nov 2018 23:00:20 -0800 (PST) MIME-Version: 1.0 From: Yongkai Wu Date: Tue, 13 Nov 2018 15:00:09 +0800 Message-ID: Subject: [PATCH] mm/hwpoison: fix incorrect call put_hwpoison_page() when isolate_huge_page() return false To: n-horiguchi@ah.jp.nec.com Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org X-Bogosity: Ham, tests=bogofilter, spamicity=0.000026, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP when isolate_huge_page() return false,it won't takes a refcount of page, if we call put_hwpoison_page() in that case,we may hit the VM_BUG_ON_PAGE! Signed-off-by: Yongkai Wu --- mm/memory-failure.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) } diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 0cd3de3..ed09f56 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1699,12 +1699,13 @@ static int soft_offline_huge_page(struct page *page, int flags) unlock_page(hpage); ret = isolate_huge_page(hpage, &pagelist); - /* - * get_any_page() and isolate_huge_page() takes a refcount each, - * so need to drop one here. - */ - put_hwpoison_page(hpage); - if (!ret) { + if (ret) { + /* + * get_any_page() and isolate_huge_page() takes a refcount each, + * so need to drop one here. + */ + put_hwpoison_page(hpage); + } else { pr_info("soft offline: %#lx hugepage failed to isolate\n", pfn); return -EBUSY;