Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3476854imu; Sun, 11 Nov 2018 16:00:31 -0800 (PST) X-Google-Smtp-Source: AJdET5fV0+D5neoTrTWFEE8zCslx0k6Qp4SRaNvm+2vO7dARIm3mH4n99HUXv4u+QlqUOwxgC2CM X-Received: by 2002:a63:7044:: with SMTP id a4mr15141512pgn.359.1541980831776; Sun, 11 Nov 2018 16:00:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980831; cv=none; d=google.com; s=arc-20160816; b=DX8pxT3ZSWzjdj0J+9GUM4J1AwfCx2EexWOpXlvZNK0qW8GE8NplIkSNa0TyWuldTn jBi6nD7PKZbh5TSrHsivK78QhZw41zupvkaZoNRjKyPBKngDabzTolUYySDr5laoKxzU hfDJvM17MsYVWQLlHtRDVIVv/AO6eS3VriqVAbTtViXOdanuT/xhodPC6mLw8m17uqZG qVmhtlKI47ErrjomyKdiLh9LQmGAlRSxunw1paSYw1TkH3XW/IHNoEN+0jw/MLu2so// 7GKiHC1YE+CKvamwXrGqKe7vR3Nq8bn6B+Vq0aDCp7L55KUDXWT8Xrk7frrzbZwWSD7H DZww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=5lOHXfzYutK1ZHEr+VGhla96Jl9Q2sF8XarSfZ4Wv+4=; b=yCvcVbNfei6FA2qtG77NCUt5ndFR/m4h6UL97xoQYtgCNj39TY997BkCf/U36jS6iS sthydU4HiosUWrd5PdKVRweBKN4DagL4TuUmCVHoke8D+LFJ/j7xyqlndfMbC8nZri9P FahS1mjpBVSHMRWaQEvcLBp+LVdCgAbkPMl9q6t9IL186kE5skdknabQFLdTRjw4fWgT z26GgM6E1pM5qOzW4c6MTeynMWAzCur+9KnLy7wkeijai8/N2jkTRcCtom6e+MlJaggu Kp9vc0s/+yOOC81obRs2/5f9nodXalEuqAF1kQgbDT+cr4w0nOX8rwcUZ3ZutXZAUdco yWgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=JoGIpmZl; 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 p19-v6si15465043plr.124.2018.11.11.16.00.16; Sun, 11 Nov 2018 16:00:31 -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; dkim=pass header.i=@kernel.org header.s=default header.b=JoGIpmZl; 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 S1732625AbeKLJuX (ORCPT + 99 others); Mon, 12 Nov 2018 04:50:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:35400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732312AbeKLISC (ORCPT ); Mon, 12 Nov 2018 03:18:02 -0500 Received: from localhost (unknown [206.108.79.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8AA69223D1; Sun, 11 Nov 2018 22:28:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975286; bh=8UJpUTfTmmg/FBMNAQD3hJKCWniytA5WdMHoyYtCMCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JoGIpmZlgddPJAi3qmluKjNljfdPSMWiDNtAw3PRmRO2x12vaxBQMpAbwooqwzb7A +plOFYfdKyYjO0+TQkyrNCZ6vGO+d1fdQK79vHTvnPAOWsNNfo3DlucMOSRooJoOaL Xqv9WKqDQFPTYC8iXOkWCUQjdkg00SlHPPSmU+RQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Jacek Zloch , Krzysztof Rusocki , Vishal Verma , Dan Williams Subject: [PATCH 4.19 219/361] libnvdimm, pmem: Fix badblocks population for raw namespaces Date: Sun, 11 Nov 2018 14:19:26 -0800 Message-Id: <20181111221650.554129114@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Williams commit 91ed7ac444ef749603a95629a5ec483988c4f14b upstream. The driver is only initializing bb_res in the devm_memremap_pages() paths, but the raw namespace case is passing an uninitialized bb_res to nvdimm_badblocks_populate(). Fixes: e8d513483300 ("memremap: change devm_memremap_pages interface...") Cc: Cc: Christoph Hellwig Reported-by: Jacek Zloch Reported-by: Krzysztof Rusocki Reviewed-by: Vishal Verma Signed-off-by: Dan Williams Signed-off-by: Greg Kroah-Hartman --- drivers/nvdimm/pmem.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -421,9 +421,11 @@ static int pmem_attach_disk(struct devic addr = devm_memremap_pages(dev, &pmem->pgmap); pmem->pfn_flags |= PFN_MAP; memcpy(&bb_res, &pmem->pgmap.res, sizeof(bb_res)); - } else + } else { addr = devm_memremap(dev, pmem->phys_addr, pmem->size, ARCH_MEMREMAP_PMEM); + memcpy(&bb_res, &nsio->res, sizeof(bb_res)); + } /* * At release time the queue must be frozen before