From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78A98C28CF6 for ; Tue, 24 Jul 2018 19:46:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3471E20874 for ; Tue, 24 Jul 2018 19:46:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3471E20874 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388666AbeGXUy1 (ORCPT ); Tue, 24 Jul 2018 16:54:27 -0400 Received: from mga11.intel.com ([192.55.52.93]:3470 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388470AbeGXUy0 (ORCPT ); Tue, 24 Jul 2018 16:54:26 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jul 2018 12:46:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,398,1526367600"; d="scan'208";a="57568833" Received: from unknown (HELO localhost.localdomain) ([10.232.112.44]) by fmsmga008.fm.intel.com with ESMTP; 24 Jul 2018 12:46:26 -0700 Date: Tue, 24 Jul 2018 13:46:29 -0600 From: Keith Busch To: "Gustavo A. R. Silva" Cc: Dan Williams , Ross Zwisler , Vishal Verma , Dave Jiang , linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] libnvdimm: fix NULL pointer dereference Message-ID: <20180724194629.GA13685@localhost.localdomain> References: <20180724134006.GA2775@embeddedor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180724134006.GA2775@embeddedor.com> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 24, 2018 at 08:40:06AM -0500, Gustavo A. R. Silva wrote: > ndd is being dereferenced before it is null checked, hence there is a > potential null pointer dereference. > > Fix this by moving the pointer dereference after ndd has been properly > null checked at line 554: if (!ndd) I'll fold this into v4 of the patch since Vishal found an issue when a DIMM has multiple regions.