Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423412AbdD0WZ1 (ORCPT ); Thu, 27 Apr 2017 18:25:27 -0400 Received: from g2t2354.austin.hpe.com ([15.233.44.27]:30619 "EHLO g2t2354.austin.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161865AbdD0WZK (ORCPT ); Thu, 27 Apr 2017 18:25:10 -0400 From: "Kani, Toshimitsu" To: "dan.j.williams@intel.com" , "linux-nvdimm@lists.01.org" CC: "linux-kernel@vger.kernel.org" , "linux-acpi@vger.kernel.org" , "vishal.l.verma@intel.com" Subject: Re: [PATCH] libnvdimm, pmem: fix badblocks notification crash Thread-Topic: [PATCH] libnvdimm, pmem: fix badblocks notification crash Thread-Index: AQHSv6PtVgq0uysXT06LC9cADBN5wqHZytAA Date: Thu, 27 Apr 2017 22:25:07 +0000 Message-ID: <1493331874.30303.1.camel@hpe.com> References: <149333101097.4714.1923436715100717938.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <149333101097.4714.1923436715100717938.stgit@dwillia2-desk3.amr.corp.intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=hpe.com; x-originating-ip: [15.219.163.8] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;AT5PR84MB0258;7:6RfHuX5PkZbBRyzxn6Hjz1zL2sTHssMCZoVV4ZOIm+k5yGUh4p7Daiev0jkW2WvSFcowcyvOkTn9tKfSjKnrK66/bqYn1EEIZBE8yR7abtn2xoYLxSMKE4FWL08Apq3c4Cszy9FTt0IUm0pM7oCSg1bZgk5B3/mvD83viyy1McYb/LYg8YfaGXH3fKNmIIQVRvkMTmM3+wXtsR6NTnd6eFpNPmpmXMCMO2Nr4R3fNU6aQIAeGTKOd8cOf2vDXEObspw3PGo02dQMtt/XLTz7ds96kXomeZnekhu2iQ1SC/0hcipaUcFHzkQVzRKnCdNbJoUXsITuLR5JaKhtzUelyw== x-ms-office365-filtering-correlation-id: 2684b214-1f07-4a53-e684-08d48dbc4259 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423075)(201703031133081)(201702281549075);SRVR:AT5PR84MB0258; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040450)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041248)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123560025)(20161123562025)(6072148);SRVR:AT5PR84MB0258;BCL:0;PCL:0;RULEID:;SRVR:AT5PR84MB0258; x-forefront-prvs: 029097202E x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39410400002)(39400400002)(39840400002)(39850400002)(39860400002)(39450400003)(377424004)(24454002)(2501003)(102836003)(189998001)(76176999)(103116003)(54356999)(81166006)(3846002)(6246003)(66066001)(8676002)(8936002)(50986999)(7736002)(305945005)(86362001)(5660300001)(3660700001)(229853002)(2900100001)(33646002)(4326008)(6486002)(6506006)(77096006)(2906002)(6512007)(6436002)(53936002)(54906002)(36756003)(38730400002)(122556002)(25786009)(3280700002)(2950100002);DIR:OUT;SFP:1102;SCL:1;SRVR:AT5PR84MB0258;H:AT5PR84MB0260.NAMPRD84.PROD.OUTLOOK.COM;FPR:;SPF:None;MLV:sfv;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="utf-8" Content-ID: <421223E9121FF449B0C5ABD81595181C@NAMPRD84.PROD.OUTLOOK.COM> MIME-Version: 1.0 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Apr 2017 22:25:07.1877 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: AT5PR84MB0258 X-OriginatorOrg: hpe.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v3RMQmYE015896 Content-Length: 1076 Lines: 32 On Thu, 2017-04-27 at 15:10 -0700, Dan Williams wrote: > The nd_pmem_notify() routine is called whenever an ARS > (address-range-scrub) completes to communicate results to the > per-namespace badblocks instances. > > When the namespace is in btt mode we crash because we do not allocate > a struct pmem_device instance in that case. Resulting in the > following crash signature: > >  BUG: unable to handle kernel NULL pointer dereference at > 0000000000000030 >  IP: nd_pmem_notify+0x30/0xf0 [nd_pmem] >  Call Trace: >   nd_device_notify+0x40/0x50 >   child_notify+0x10/0x20 >   device_for_each_child+0x50/0x90 >   nd_region_notify+0x20/0x30 >   nd_device_notify+0x40/0x50 >   nvdimm_region_notify+0x27/0x30 >   acpi_nfit_scrub+0x341/0x590 [nfit] >   process_one_work+0x197/0x450 >   worker_thread+0x4e/0x4a0 >   kthread+0x109/0x140 > > Given that we don't even populate the btt badblocks instance, just > return early and skip the device to region lookup. We populate the btt badblocks into nsio->bb, and check/clear them in nsio_rw_bytes(). Thanks, -Toshi