Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1735810
| From | "Jason A. Donenfeld" <Jason@zx2c4.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH v7 1/2] security/keys: properly zero out sensitive key material in big_key |
| Date | 2017-09-20 17:00 +0200 |
| Message-ID | <urODM-4pI-5@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Error paths forgot to zero out sensitive material, so this patch changes
some kfrees into a kzfrees.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reviewed-by: Eric Biggers <ebiggers3@gmail.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Kirill Marinushkin <k.marinushkin@gmail.com>
Cc: security@kernel.org
Cc: stable@vger.kernel.org
---
security/keys/big_key.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/security/keys/big_key.c b/security/keys/big_key.c
index 6acb00f6f22c..507d6fb86a4f 100644
--- a/security/keys/big_key.c
+++ b/security/keys/big_key.c
@@ -195,7 +195,7 @@ int big_key_preparse(struct key_preparsed_payload *prep)
*path = file->f_path;
path_get(path);
fput(file);
- kfree(data);
+ kzfree(data);
} else {
/* Just store the data in a buffer */
void *data = kmalloc(datalen, GFP_KERNEL);
@@ -211,9 +211,9 @@ int big_key_preparse(struct key_preparsed_payload *prep)
err_fput:
fput(file);
err_enckey:
- kfree(enckey);
+ kzfree(enckey);
error:
- kfree(data);
+ kzfree(data);
return ret;
}
@@ -227,7 +227,7 @@ void big_key_free_preparse(struct key_preparsed_payload *prep)
path_put(path);
}
- kfree(prep->payload.data[big_key_data]);
+ kzfree(prep->payload.data[big_key_data]);
}
/*
@@ -259,7 +259,7 @@ void big_key_destroy(struct key *key)
path->mnt = NULL;
path->dentry = NULL;
}
- kfree(key->payload.data[big_key_data]);
+ kzfree(key->payload.data[big_key_data]);
key->payload.data[big_key_data] = NULL;
}
@@ -328,7 +328,7 @@ long big_key_read(const struct key *key, char __user *buffer, size_t buflen)
err_fput:
fput(file);
error:
- kfree(data);
+ kzfree(data);
} else {
ret = datalen;
if (copy_to_user(buffer, key->payload.data[big_key_data],
--
2.14.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH v7 1/2] security/keys: properly zero out sensitive key material in big_key "Jason A. Donenfeld" <Jason@zx2c4.com> - 2017-09-20 17:00 +0200
[PATCH v7 2/2] security/keys: rewrite all of big_key crypto "Jason A. Donenfeld" <Jason@zx2c4.com> - 2017-09-20 17:00 +0200
Re: [PATCH v7 2/2] security/keys: rewrite all of big_key crypto David Howells <dhowells@redhat.com> - 2017-09-25 16:50 +0200
Re: [PATCH v7 2/2] security/keys: rewrite all of big_key crypto "Jason A. Donenfeld" <Jason@zx2c4.com> - 2017-09-25 18:40 +0200
csiph-web