Received: by 10.223.185.116 with SMTP id b49csp213245wrg; Thu, 15 Feb 2018 20:11:59 -0800 (PST) X-Google-Smtp-Source: AH8x225lKaKOeaw0G4TqOQOFMdDd8/AZttqjOlrQeatxxeXpma0icO5wiDJBfbmZEt/FOstrG20y X-Received: by 2002:a17:902:8498:: with SMTP id c24-v6mr4603329plo.450.1518754319807; Thu, 15 Feb 2018 20:11:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518754319; cv=none; d=google.com; s=arc-20160816; b=U/KnXmp8ROg1V/8QMY1lkHzBzPIFAry8TlZsTbPYdJpf/61NctZbtbMysDzC6388qL NkDrZ4VFtvUqv/GBnSBkUbOPWRX4Yi/CHI4UzSFU+1K0vLukTLYnrHSCVuGP3QXVSahu yRtilAUHzvCf3vXpiDiIHM+yXjfTFm/E13jwEdjtubGZJUZNCkCCPHdG9GlMGWqZoulQ yKj5QFz4NIqfZ+hO93/V7P08+nHxbjo0i5NWdwZarJGxRmYvUgwwEasbA5wQXzECU1vB u5gV2kvc/LvooQS8XPxkTFanMtBKQd8DU5ejaLv2/Aj2B963Fiv/Ubb8rp+Al7HMAju9 3aLQ== 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=YKHIOaHkwxrIl+iRVMJ25ovljuRj41F6nnJo1y/dGWc=; b=VSAWiICjAnSQAl9/eG5X+HvzxhP25+Lmte0+gQ7vYlGt0dGfQxZtKyk1xjYZv70iY/ 9ncAZCzN5MPYdab+InDnTjZW5uEg+pj1YsUzIfWf7NNWE3QQ//T3fgAJ4xWrg5Bs3joH MqYUhJQp8VPO71u8LIHA0o3Nv4LccKN3JCxKPt9QmZ5HXWUlPIbgH1TCoj4nZqTdTxBg ucx3HOVrGhIUqX1LcYRGrBQTaFR5xtWHxeN7FvYmRmXm7Ck3FlznQinTO8UOWrIyB1L4 HXHLMn56+IgmwWScr2qseWMIAkyijGNkIqkl2p2rkMonjfmE/luqGGteXYBD5puznix9 t3XQ== 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 b6si1160651pfl.14.2018.02.15.20.11.31; Thu, 15 Feb 2018 20:11:59 -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 S1424898AbeBOPr2 (ORCPT + 99 others); Thu, 15 Feb 2018 10:47:28 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:36196 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424880AbeBOPrX (ORCPT ); Thu, 15 Feb 2018 10:47:23 -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 92DCE104D; Thu, 15 Feb 2018 15:47:22 +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.15 191/202] acpi, nfit: fix register dimm error handling Date: Thu, 15 Feb 2018 16:18:11 +0100 Message-Id: <20180215151722.728109974@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@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.15-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 @@ -1867,6 +1867,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,