Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp26018838rwd; Mon, 3 Jul 2023 04:30:09 -0700 (PDT) X-Google-Smtp-Source: APBJJlFLviN4pQ8tSp1Z4OGM0+iaiMmYtCAMkaj5DbMEWulIsEUf/K3YCgVjAgBtEUP1Dkb25U61 X-Received: by 2002:a05:6a00:1742:b0:67c:c8e4:8689 with SMTP id j2-20020a056a00174200b0067cc8e48689mr9069953pfc.12.1688383808701; Mon, 03 Jul 2023 04:30:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688383808; cv=none; d=google.com; s=arc-20160816; b=sJLuKljk3xoEL/4cuqJTO0BLD3wQFA2Ojj14JWd1jCXoxKkB6U5jGRDbBwzLQHECCx nXXQH1Ve+sSQQeS7/20oNmZdaoFpwZFkuL7YhKTD7s4rJOpTTeTlKJCM2KkFn9lFD5L7 9XBhjQE3nkAJEoiOhYRgovF2gK6z77SgIggLvQVsKY26XUO6oEFDBNGFc32YRxpgKllh LG9kY03Ux2tTxcWACMl0vXlS5HEbzwn9BUNxyUkswqHBnwKHzwtisiohVIeGu0+mTP56 1cOhQGZQBTh9A11JL8vXEFSfWOA+mKxHsUnaAplrEmZTjOnsR32/PWR2OuzIdK2GEl8k wtaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=0Xh/JP1urOFJZ8WOlTt/YcfSGa0riIpuL8tfx547Gj8=; fh=hcP9j9ILY6EYxS5RtqkBhaOJm2xC26RS78X+yE+pfy4=; b=ryCk5Zx254jjr/oJdWptph57KNZXAyTydUC2hprRJlIeu3xozfSDi+jUfHzp7fpblg GEXI6+4K8AmPsBLxDRFZEFy6TgFnNSEM4FlBimleI40dqXlWKzSCjGtAvq5W7CP2SK5J b1hW+xoDAwOFjM1IYxEqipujNleLq7HkPTC2WhNqxy6nmUlXT/gdnwCawEY6hAtzc9BL tPedSePJq3jmeqid9/+3BLwmgDlb8XC0LTTWfXsGvrEMxpmik5/GCvuCfuavSoVVb/jk 0c+LAQleCCMuc7MwOA2cKvUYxwqKsdpTHnkE4Rx6ZseKOJTVRTY/7UCKOLYAJr1NdB2E SwYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a056a00194d00b0068225e629aesi9565389pfk.0.2023.07.03.04.29.55; Mon, 03 Jul 2023 04:30:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230224AbjGCL1b (ORCPT + 99 others); Mon, 3 Jul 2023 07:27:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229975AbjGCL1a (ORCPT ); Mon, 3 Jul 2023 07:27:30 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC5FEE3 for ; Mon, 3 Jul 2023 04:27:29 -0700 (PDT) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QvkC66FhPzTlX6; Mon, 3 Jul 2023 19:26:26 +0800 (CST) Received: from [10.174.151.185] (10.174.151.185) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 3 Jul 2023 19:27:26 +0800 Subject: Re: [PATCH] mm: memory-failure: fix potential page refcnt leak in memory_failure() To: Naoya Horiguchi CC: , , , References: <20230701072837.1994253-1-linmiaohe@huawei.com> <20230703063713.GA3012709@ik1-406-35019.vs.sakura.ne.jp> From: Miaohe Lin Message-ID: <1e8ff9bf-c81b-9c39-9f44-2f82efcd36ec@huawei.com> Date: Mon, 3 Jul 2023 19:27:25 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: <20230703063713.GA3012709@ik1-406-35019.vs.sakura.ne.jp> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.151.185] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023/7/3 14:37, Naoya Horiguchi wrote: > On Sat, Jul 01, 2023 at 03:28:37PM +0800, Miaohe Lin wrote: >> put_ref_page() is not called to drop extra refcnt when comes from madvise >> in the case pfn is valid but pgmap is NULL leading to page refcnt leak. > > Is this test scenario realistic one? I don't think that we can call madvise() for > such a device memory page. If this is the case, this issue can be thought as > potentioal one (so no need to send to stable). This is a theoretical problem. If pagemap can ever be NULL after page refcnt is increased, this would occur. I think it's not needed to send to stable too. > >> >> Fixes: 1e8aaedb182d ("mm,memory_failure: always pin the page in madvise_inject_error") >> Signed-off-by: Miaohe Lin > > Anyway, the patch looks good to me. Thanks you. > > Acked-by: Naoya Horiguchi Thanks for your review and comment.