From: Dave Jiang <dave.jiang@intel.com>
To: Dan Williams <dan.j.williams@intel.com>, keyrings@vger.kernel.org
Cc: Vishal Verma <vishal.l.verma@intel.com>,
Keith Busch <keith.busch@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/6] libnvdimm/security: Drop direct dependency on key_type_encrypted
Date: Tue, 19 Mar 2019 09:46:23 -0700 [thread overview]
Message-ID: <85a59ce3-c2c5-7127-8da7-637509adb830@intel.com> (raw)
In-Reply-To: <155297559082.2276575.2158004875457450595.stgit@dwillia2-desk3.amr.corp.intel.com>
On 3/18/19 11:06 PM, Dan Williams wrote:
> Lookup the key type by name and protect libnvdimm from encrypted_keys.ko
> module load failures.
>
> Cc: Vishal Verma <vishal.l.verma@intel.com>
> Cc: Dave Jiang <dave.jiang@intel.com>
> Cc: Keith Busch <keith.busch@intel.com>
> Cc: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> drivers/nvdimm/security.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/nvdimm/security.c b/drivers/nvdimm/security.c
> index f8bb746a549f..7f9e412f743a 100644
> --- a/drivers/nvdimm/security.c
> +++ b/drivers/nvdimm/security.c
> @@ -48,12 +48,17 @@ static void nvdimm_put_key(struct key *key)
> static struct key *nvdimm_request_key(struct nvdimm *nvdimm)
> {
> struct key *key = NULL;
> + struct key_type *type;
> static const char NVDIMM_PREFIX[] = "nvdimm:";
> char desc[NVDIMM_KEY_DESC_LEN + sizeof(NVDIMM_PREFIX)];
> struct device *dev = &nvdimm->dev;
>
> sprintf(desc, "%s%s", NVDIMM_PREFIX, nvdimm->dimm_id);
> - key = request_key(&key_type_encrypted, desc, "");
> + type = key_type_lookup("encrypted");
> + if (IS_ERR(type))
> + return (struct key *) type;
> +
> + key = request_key(type, desc, "");
> if (IS_ERR(key)) {
> if (PTR_ERR(key) == -ENOKEY)
> dev_dbg(dev, "request_key() found no key\n");
> @@ -88,7 +93,7 @@ static struct key *nvdimm_lookup_user_key(struct nvdimm *nvdimm,
> return NULL;
>
> key = key_ref_to_ptr(keyref);
> - if (key->type != &key_type_encrypted) {
> + if (strcmp(key->type->name, "encrypted") != 0) {
> key_put(key);
> return NULL;
> }
> @@ -452,3 +457,5 @@ void nvdimm_security_overwrite_query(struct work_struct *work)
> __nvdimm_security_overwrite_query(nvdimm);
> nvdimm_bus_unlock(&nvdimm->dev);
> }
> +
> +MODULE_SOFTDEP("pre: encrypted_keys");
>
next prev parent reply other threads:[~2019-03-19 16:46 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-19 6:06 [PATCH 0/6] security/keys/encrypted: Break module dependency chain Dan Williams
2019-03-19 6:06 ` [PATCH 1/6] security/keys/encrypted: Allow operation without trusted.ko Dan Williams
2019-03-19 6:06 ` [PATCH 2/6] security/keys/encrypted: Clean up request_trusted_key() Dan Williams
2019-03-20 0:06 ` Mimi Zohar
2019-03-20 0:20 ` Dan Williams
2019-03-20 1:10 ` Mimi Zohar
2019-03-20 1:34 ` Dan Williams
2019-03-20 1:37 ` Dan Williams
2019-03-20 2:35 ` Mimi Zohar
2019-03-20 5:48 ` Dan Williams
2019-03-20 12:06 ` Mimi Zohar
2019-03-20 15:27 ` Dan Williams
2019-03-19 6:06 ` [PATCH 3/6] libnvdimm/security: Drop direct dependency on key_type_encrypted Dan Williams
2019-03-19 16:46 ` Dave Jiang [this message]
2019-03-19 6:06 ` [PATCH 4/6] security/keys/ecryptfs: " Dan Williams
2019-03-19 6:06 ` [PATCH 5/6] security/integrity/evm: " Dan Williams
2019-03-19 6:06 ` [PATCH 6/6] security/keys/encrypted: Drop export of key_type_encrypted Dan Williams
2019-03-19 21:01 ` [PATCH 0/6] security/keys/encrypted: Break module dependency chain Dan Williams
2019-03-19 21:08 ` James Bottomley
2019-03-19 21:23 ` Dan Williams
2019-03-20 1:20 ` Mimi Zohar
2019-03-21 13:45 ` Jarkko Sakkinen
2019-03-21 13:48 ` Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=85a59ce3-c2c5-7127-8da7-637509adb830@intel.com \
--to=dave.jiang@intel.com \
--cc=dan.j.williams@intel.com \
--cc=ira.weiny@intel.com \
--cc=keith.busch@intel.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvdimm@lists.01.org \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®