Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2076271ybp; Thu, 10 Oct 2019 01:45:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqxD6zChu1h1DgiBbu7joS3UGTgOr5YFWu04MHLnOGDiLGr1nKlwayVYawdP0ksgYBuloYRt X-Received: by 2002:a17:906:cd11:: with SMTP id oz17mr7027475ejb.71.1570697136812; Thu, 10 Oct 2019 01:45:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570697136; cv=none; d=google.com; s=arc-20160816; b=oh7nSPaCg/05+PaxW4gS/EF6gNSj1a2wDjvpc8zMkQ+Kagsyu1SBh2xi2hH1TlLgvs 7VKTRKyYzx1kn4jEQNv6Ljm9EWqBogS2rlCEufbK7JX9uxmpKmGIoXKrplzYzjQCDBvC Mn1gca5fUDDH727i7FhXAckQoqdxEkh4UDhIWwheGygxK20P1sYv7H77F0x813r1N1rZ 61fZRvqOnGD6PrSk+lAyozeC2nviwLO/xOz9v/VpFw2/o6RACcnmyJyqr3/RVx8pwmQt gy2bdQOzSwtSzVHYQdXRhcdWWirb2Fbqmelo8DnejsVWtpTL/E0ukITopL220EVLD8iz 2V9g== 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=9jfnSj0XT9aZ7LycTCUhLFK3Gf4mpQrw3EKgTdRTS4k=; b=ka+xmAUvyfyhLYe6wLwyM5hn+ATjxlZOlo3FMWb7VHtl2TVuHG2RMuXGpi9oOAuPQH +o5iJcVMIbweVvJGBXKXNAmGUCJpM8bm6EcKzEcKzV2pVP9RLIZCx+D1WoeG4fniwAYT /ldFML5HDXC7yBhp/l/HEcWtkMczyqFE4ThgLnT8w4uElU3Jgbd8CWB+uK5JyagXkxLm 0K4l263vjlqwDLEmDrc140skyoNYxhqY8pYx7b2i8MRAHxw4WjBvBopGmnplkFPry7+W HPLTD92qAhJxC5UAvBaBKimeCJzERUWNvylSTIwlA/kmQ8z7RUXySYSIE+0qZmT8SdYU FecA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vGdOZxCH; 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 ck2si2641473ejb.346.2019.10.10.01.45.13; Thu, 10 Oct 2019 01:45:36 -0700 (PDT) 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=vGdOZxCH; 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 S2388211AbfJJIoK (ORCPT + 99 others); Thu, 10 Oct 2019 04:44:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:49220 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388871AbfJJIoJ (ORCPT ); Thu, 10 Oct 2019 04:44:09 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 C9A33218AC; Thu, 10 Oct 2019 08:44:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1570697048; bh=qv0kulbhoW1t2kZ9x0JtcOuqZ0b2dtS8hxMB6oS1WbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vGdOZxCH3B+Gpo8E2+2+Iz0CXE2oN2A5javNDMaeDNx4Ces9N6RwunJY8DtlmCCJC 9LLLdjMHtxlUNlGCEJvi3wlZbrWag5F3/qZEUyiao7lJkfEq/0d+7q4TIQfoYen86i zsHr2huV/2dD8R5oBBucZpV9K9F/k/h4Iyq4uerE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Jiang , Dan Williams , Sasha Levin Subject: [PATCH 5.3 148/148] libnvdimm: prevent nvdimm from requesting key when security is disabled Date: Thu, 10 Oct 2019 10:36:49 +0200 Message-Id: <20191010083621.227581588@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191010083609.660878383@linuxfoundation.org> References: <20191010083609.660878383@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Dave Jiang [ Upstream commit 674f31a352da5e9f621f757b9a89262f486533a0 ] Current implementation attempts to request keys from the keyring even when security is not enabled. Change behavior so when security is disabled it will skip key request. Error messages seen when no keys are installed and libnvdimm is loaded: request-key[4598]: Cannot find command to construct key 661489677 request-key[4606]: Cannot find command to construct key 34713726 Cc: stable@vger.kernel.org Fixes: 4c6926a23b76 ("acpi/nfit, libnvdimm: Add unlock of nvdimm support for Intel DIMMs") Signed-off-by: Dave Jiang Link: https://lore.kernel.org/r/156934642272.30222.5230162488753445916.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Dan Williams Signed-off-by: Sasha Levin --- drivers/nvdimm/security.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/nvdimm/security.c b/drivers/nvdimm/security.c index a570f2263a424..5b7ea93edb935 100644 --- a/drivers/nvdimm/security.c +++ b/drivers/nvdimm/security.c @@ -177,6 +177,10 @@ static int __nvdimm_security_unlock(struct nvdimm *nvdimm) || nvdimm->sec.state < 0) return -EIO; + /* No need to go further if security is disabled */ + if (nvdimm->sec.state == NVDIMM_SECURITY_DISABLED) + return 0; + if (test_bit(NDD_SECURITY_OVERWRITE, &nvdimm->flags)) { dev_dbg(dev, "Security operation in progress.\n"); return -EBUSY; -- 2.20.1