Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp572716iog; Mon, 13 Jun 2022 08:22:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRSwjUIAFe9nFdXW2xNTq8w+E7qTxkU5ESf8Fl854jLzEZ3u9G4MoiqU0R92VBlooz4st5 X-Received: by 2002:a17:907:e91:b0:707:c7af:93aa with SMTP id ho17-20020a1709070e9100b00707c7af93aamr351559ejc.382.1655133763236; Mon, 13 Jun 2022 08:22:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655133763; cv=none; d=google.com; s=arc-20160816; b=qOAhLm3Ayo9emzKccD+FMRilu7Mv6wNI1Vom3koBrnYXdUoBRlor7QA/d0/w3n4u/s 5naRUVQe0VN686yvtpT154C1OQEjHfsN5oIuvCRa//npE7iJGMgOR5MWF0b7LrOxJdss FcCcvbUnsPpJ+De8jjSmOSlLYqEW1mT+XMJzNVS3TVJTwJm0kIxuVM2MzDLVPx0rfSVM RmdQQEZqOyVdIAdAg3LUeON7RW5CIqurOr6vILreR2h93CLSJKUiNDLwjsLbBJkXX9Ry blTaxfSrZNcMTnAPvC4KgbSYuy7+v5JA1pP51dukebLLDPP1nGcauXCMyqc+z5SlsqTt RYyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=L7PMlEDY8tCyebYw3qz2xiefhMAkCh+TZ0Dzo3xNZms=; b=hRtlYRz0mEdk79iVXnHbu9yX4M3ZOk+KfIhUWAybnBAT/duVD5EK9GPxZjdOkt67L+ k3XX9Z7bqbPizXRi3cSIT1xvtbVTyMU9ni2f5YJhwj7p5atSMh8cvT1b29lBSr0jWdP9 m/ifVPpcV7QLAU90VXuBkRHmxzEyBvsrcEAz9FIvyKj2LLCOHs9mbplcABcT/Hj98jU4 3l9ZFhP5ZzH6+wqMP5UNPXstXPV3YEWEGS167LJAQZp/dQo81kiGizOWqri1Hw0MxCb/ so8xK1oUWzLDfGTGkHrkJV2ligZill1EgDHqjI13Hlt4J9xOJSeFT1i47BaCwJPRATbo j5Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0/Es6xM8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr10-20020a170907720a00b00718c7b4cc15si3012800ejc.103.2022.06.13.08.22.18; Mon, 13 Jun 2022 08:22:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="0/Es6xM8"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352957AbiFMLYm (ORCPT + 99 others); Mon, 13 Jun 2022 07:24:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353740AbiFMLQQ (ORCPT ); Mon, 13 Jun 2022 07:16:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01B1E13E3D; Mon, 13 Jun 2022 03:39:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 933BD6119F; Mon, 13 Jun 2022 10:39:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99A2EC34114; Mon, 13 Jun 2022 10:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655116791; bh=lDsK+540RmwREZaERlJaP2SKBGrB1xvgPEhdWnr0PS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0/Es6xM8rh1vW0q0a/6F/sP4amyT5ECtqDy0odKn0EafKGa6eQi9Li8PiIBAqhey4 PrOoTH568h6XE1aNYyh9/GsVSrPeSIYOajqr1uOdw3qLO/SurD7cnAG6z8n+sV9Kpt FzM3eHxH4lQNcz/vCcmPQAxhCrD6E0lDEjT2GTI0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vishal Verma , Dave Jiang , Ira Weiny , Jeff Moyer , Krzysztof Kensicki , Dan Williams , Sasha Levin Subject: [PATCH 5.4 175/411] nvdimm: Allow overwrite in the presence of disabled dimms Date: Mon, 13 Jun 2022 12:07:28 +0200 Message-Id: <20220613094933.904632229@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Williams [ Upstream commit bb7bf697fed58eae9d3445944e457ab0de4da54f ] It is not clear why the original implementation of overwrite support required the dimm driver to be active before overwrite could proceed. In fact that can lead to cases where the kernel retains an invalid cached copy of the labels from before the overwrite. Unfortunately the kernel has not only allowed that case, but enforced it. Going forward, allow for overwrite to happen while the label area is offline, and follow-on with updates to 'ndctl sanitize-dimm --overwrite' to trigger the label area invalidation by default. Cc: Vishal Verma Cc: Dave Jiang Cc: Ira Weiny Cc: Jeff Moyer Reported-by: Krzysztof Kensicki Fixes: 7d988097c546 ("acpi/nfit, libnvdimm/security: Add security DSM overwrite support") Signed-off-by: Dan Williams Signed-off-by: Sasha Levin --- drivers/nvdimm/security.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/drivers/nvdimm/security.c b/drivers/nvdimm/security.c index 35d265014e1e..0e23d8c27792 100644 --- a/drivers/nvdimm/security.c +++ b/drivers/nvdimm/security.c @@ -379,11 +379,6 @@ static int security_overwrite(struct nvdimm *nvdimm, unsigned int keyid) || !nvdimm->sec.flags) return -EOPNOTSUPP; - if (dev->driver == NULL) { - dev_dbg(dev, "Unable to overwrite while DIMM active.\n"); - return -EINVAL; - } - rc = check_security_state(nvdimm); if (rc) return rc; -- 2.35.1