Received: by 10.223.185.116 with SMTP id b49csp2343383wrg; Thu, 15 Feb 2018 10:07:30 -0800 (PST) X-Google-Smtp-Source: AH8x225isbXc9s8ODL4dswYz84HXggkl2lH5PvEtjE9hUpeVR78obdzpqG5FtW4anYIekbKNDegV X-Received: by 2002:a17:902:7485:: with SMTP id h5-v6mr3357689pll.236.1518718050420; Thu, 15 Feb 2018 10:07:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518718050; cv=none; d=google.com; s=arc-20160816; b=LgWZ8QIBtmkpMtvpXdaLSOy/B8FKq8xHvy4UWFaj9s7csgK0NrLtVhRKOI0PQnQswX lOFXuG8SWtq4ZoNE48wZSlztQmGhTefcJwi60kkI9SJTaAzPvFwLXlsqHpF5/IaZ7n58 Xveth6LEgtYaOg7igDld/UnKS9ppRlj/QeE3dZXDivERuuhb/woJ5t4WrbOpvqPKL3JT V9E56t0ovEnLydAA3QuiyNCxGMVyjGfEQYqcK78narSfgkvnkmqGpl5womLIVdwJbuOD b/Wpcyw4c4iG9F1k7InWWCkog9DpbOtScShZFJ+3BEzevLzCS+izxqZ7xAg+xKm/gRR3 Aqcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=+bNL1gLM0RTZ61VGFTWF5fQP9ya5uIr+gWeHKNULyG4=; b=fJoaiDvuLbXlDeV777RjoATFq7wYFtfjMpPW5bBrGegVdbjDob40RbmlRgJe0T5jSK 3MuAGJ6wLztiRVS36OFAh+wJVN8vnQTlF1IQ3zLLxxMpvQ0FVAj2nUsRDlzJ0lPgVUaB nnW8hwL4QQoDRsVBTXl9WXcUqbKtRNz++q0LcwfSHSZz0h/MGyIzhC9KI0DhD6kQyEDe 4U9j6xyvXuVgiP3YBDPiHaldgxeQQ0mK4aViFU4DdrTy5uFH1C8Z9ppDpHzcwNnh0iQi DktSAxBGnMbNjLEcTX5StYbAWcZDnXwfwFG4g6S/q/9T9/8ymPPAZxP4uDGSUHbdx/B7 3JUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a72si76501pfj.343.2018.02.15.10.07.15; Thu, 15 Feb 2018 10:07:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1164020AbeBOP3V (ORCPT + 99 others); Thu, 15 Feb 2018 10:29:21 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:54366 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164003AbeBOP3R (ORCPT ); Thu, 15 Feb 2018 10:29:17 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 0830210B1; Thu, 15 Feb 2018 15:29:16 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Toshi Kani , "Rafael J. Wysocki" , Dan Williams Subject: [PATCH 4.9 85/88] acpi, nfit: fix register dimm error handling Date: Thu, 15 Feb 2018 16:17:52 +0100 Message-Id: <20180215151234.232466114@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151222.437136975@linuxfoundation.org> References: <20180215151222.437136975@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Toshi Kani commit 23fbd7c70aec7600e3227eb24259fc55bf6e4881 upstream. A NULL pointer reference kernel bug was observed when acpi_nfit_add_dimm() called in acpi_nfit_register_dimms() failed. This error path does not set nfit_mem->nvdimm, but the 2nd list_for_each_entry() loop in the function assumes it's always set. Add a check to nfit_mem->nvdimm. Fixes: ba9c8dd3c222 ("acpi, nfit: add dimm device notification support") Signed-off-by: Toshi Kani Cc: "Rafael J. Wysocki" Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/nfit/core.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -1535,6 +1535,9 @@ static int acpi_nfit_register_dimms(stru struct kernfs_node *nfit_kernfs; nvdimm = nfit_mem->nvdimm; + if (!nvdimm) + continue; + nfit_kernfs = sysfs_get_dirent(nvdimm_kobj(nvdimm)->sd, "nfit"); if (nfit_kernfs) nfit_mem->flags_attr = sysfs_get_dirent(nfit_kernfs,