Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1570144pxb; Sun, 17 Jan 2021 14:06:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJydYJd7GBcRq/2nvAEU8vTT4Z+iUxDGDx7ehOG13rQEJO87Na8oJdgAqKkCx7V7hwtLrZZJ X-Received: by 2002:a17:906:758:: with SMTP id z24mr15162156ejb.3.1610921166961; Sun, 17 Jan 2021 14:06:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610921166; cv=none; d=google.com; s=arc-20160816; b=plo4SlBgsdy79K1qYZH9zqnp+7/ladVMWh/XPw5REbfTsnY8F2wFzlwCS6VXp1cLT0 cJ49uph3r4SOjGWXnpfbL/xc7udDLQG8OzF26Sworcqj/hf5e/j/5GeTLVubH0lkZP/8 tWLmFz1APDxr7tV6z1v4tKMU+XieLoDBKYj3YogKBP6tZ52Tp1l0YiD2/ZmKU4a7wJqQ bmZ/cTqfpehNWUpxzrMWdX5O+wDd8FQ5sl1JFklUKDDv6s03seuMEKaHXjq8161ALO45 Ua+/uZ8GwN0X9l4Ex4Og8Y2Cxr4RV5ew+FgOen1Dx26vw6lXli9ZFgBpGwI77Qijnz5U YpVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=RDk6/CIIWjJxQYPzcX84yQLEBLbr/l/7TpjhkHmnLts=; b=Y8Oj9kP+b3iUmLoLFrvelWwVHUrDx2/R8prOmy6qOeUkwQOeKzYh80DhfoPQjan37/ kx2+U0zRgOVy4Lskpw7b+pNSclPWHMWMSLfTMOBtvmoKWoyQhn7rDh4o2duubfA1dpdr jaftz7qY6vhiACVr6KbGRI0D9XrFRaTUmeivSLkOJ+5FhghWr4nl6FI0MdsJb3N3A4Cn kRM1OV9R2xL47xt+bqJNjWWFF+Xxw7GmUBR6Wzd5/WJUQQDjJcAb0meer022wbekcqen v34rs5aZGGSxAIUkAltA4RKQVBKrLGthNigMit/Z9eWdiCdWPcTdkX9EDGAf09wO6aZa ImFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=z9UWtErk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o9si5190247ejr.665.2021.01.17.14.05.43; Sun, 17 Jan 2021 14:06:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=z9UWtErk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730187AbhAQWC1 (ORCPT + 99 others); Sun, 17 Jan 2021 17:02:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:58926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729550AbhAQWCY (ORCPT ); Sun, 17 Jan 2021 17:02:24 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A339920770; Sun, 17 Jan 2021 22:01:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1610920904; bh=syw3C+yi+MfIAsKsarxDn5CIv+WBNQ1M+WvC9IOMFT0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=z9UWtErkwTPaE9iJ/e6FJXucATo+qe58tJGsr8k3lobCCopZfYhtGyFtBlcooJR7H 3MNfOmc3VwhSLYyHiIWqsJ8vJTqMAsaQUBlVrAdJazF72qPbFcDQ38Z9sMFPZD+1q2 ifjtpfMSbB3+cIjwdZ27dFCJ6CcO9Jqk8nbC1GNU= Date: Sun, 17 Jan 2021 14:01:42 -0800 From: Andrew Morton To: Dan Williams Cc: Naoya Horiguchi , Michal Hocko , David Hildenbrand , Oscar Salvador , stable@vger.kernel.org, linux-mm@kvack.org, linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 4/5] mm: Fix page reference leak in soft_offline_page() Message-Id: <20210117140142.ab91797266e0bef6b7dba9f9@linux-foundation.org> In-Reply-To: <161058501210.1840162.8108917599181157327.stgit@dwillia2-desk3.amr.corp.intel.com> References: <161058499000.1840162.702316708443239771.stgit@dwillia2-desk3.amr.corp.intel.com> <161058501210.1840162.8108917599181157327.stgit@dwillia2-desk3.amr.corp.intel.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 13 Jan 2021 16:43:32 -0800 Dan Williams wrote: > The conversion to move pfn_to_online_page() internal to > soft_offline_page() missed that the get_user_pages() reference taken by > the madvise() path needs to be dropped when pfn_to_online_page() fails. > Note the direct sysfs-path to soft_offline_page() does not perform a > get_user_pages() lookup. > > When soft_offline_page() is handed a pfn_valid() && > !pfn_to_online_page() pfn the kernel hangs at dax-device shutdown due to > a leaked reference. > > Fixes: feec24a6139d ("mm, soft-offline: convert parameter to pfn") > Cc: Andrew Morton > Cc: Naoya Horiguchi > Cc: Michal Hocko > Reviewed-by: David Hildenbrand > Reviewed-by: Oscar Salvador > Cc: > Signed-off-by: Dan Williams A cc:stable patch in the middle is awkward. I'll make this a standalone patch for merging into mainline soon (for 5.11) and shall turn the rest into a 4-patch series, OK?