[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20171003114229.928090955@linuxfoundation.org>
Date: Tue, 3 Oct 2017 14:23:12 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, "Jason A. Donenfeld" <Jason@...c4.com>,
David Howells <dhowells@...hat.com>,
Eric Biggers <ebiggers3@...il.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Kirill Marinushkin <k.marinushkin@...il.com>,
security@...nel.org
Subject: [PATCH 4.9 20/64] security/keys: properly zero out sensitive key material in big_key
4.9-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason A. Donenfeld <Jason@...c4.com>
commit 910801809b2e40a4baedd080ef5d80b4a180e70e upstream.
Error paths forgot to zero out sensitive material, so this patch changes
some kfrees into a kzfrees.
Signed-off-by: Jason A. Donenfeld <Jason@...c4.com>
Signed-off-by: David Howells <dhowells@...hat.com>
Reviewed-by: Eric Biggers <ebiggers3@...il.com>
Cc: Herbert Xu <herbert@...dor.apana.org.au>
Cc: Kirill Marinushkin <k.marinushkin@...il.com>
Cc: security@...nel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
security/keys/big_key.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/security/keys/big_key.c
+++ b/security/keys/big_key.c
@@ -194,7 +194,7 @@ int big_key_preparse(struct key_preparse
*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);
@@ -210,9 +210,9 @@ int big_key_preparse(struct key_preparse
err_fput:
fput(file);
err_enckey:
- kfree(enckey);
+ kzfree(enckey);
error:
- kfree(data);
+ kzfree(data);
return ret;
}
@@ -226,7 +226,7 @@ void big_key_free_preparse(struct key_pr
path_put(path);
}
- kfree(prep->payload.data[big_key_data]);
+ kzfree(prep->payload.data[big_key_data]);
}
/*
@@ -258,7 +258,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;
}
@@ -326,7 +326,7 @@ long big_key_read(const struct key *key,
err_fput:
fput(file);
error:
- kfree(data);
+ kzfree(data);
} else {
ret = datalen;
if (copy_to_user(buffer, key->payload.data[big_key_data],
Powered by blists - more mailing lists