Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1657253
| From | "Jason A. Donenfeld" <Jason@zx2c4.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH RFC v2 8/8] ceph: ensure RNG is seeded before using |
| Date | 2017-06-05 06:00 +0200 |
| Message-ID | <tORln-60i-1@gated-at.bofh.it> (permalink) |
| References | <tORbH-5WD-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Ceph uses the RNG for various nonce generations, and it shouldn't accept
using bad randomness. So, we wait for the RNG to be properly seeded. We
do this by calling wait_for_random_bytes() in a function that is
certainly called in process context, early on, so that all subsequent
calls to get_random_bytes are necessarily acceptable.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: "Yan, Zheng" <zyan@redhat.com>
Cc: Sage Weil <sage@redhat.com>
---
net/ceph/ceph_common.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c
index 4fd02831beed..26ab58665f77 100644
--- a/net/ceph/ceph_common.c
+++ b/net/ceph/ceph_common.c
@@ -611,7 +611,11 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private)
{
struct ceph_client *client;
struct ceph_entity_addr *myaddr = NULL;
- int err = -ENOMEM;
+ int err;
+
+ err = wait_for_random_bytes();
+ if (err < 0)
+ return ERR_PTR(err);
client = kzalloc(sizeof(*client), GFP_KERNEL);
if (client == NULL)
--
2.13.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH RFC v2 0/8] get_random_bytes_wait family of APIs "Jason A. Donenfeld" <Jason@zx2c4.com> - 2017-06-05 05:50 +0200
[PATCH RFC v2 1/8] random: add synchronous API for the urandom pool "Jason A. Donenfeld" <Jason@zx2c4.com> - 2017-06-05 05:50 +0200
[PATCH RFC v2 8/8] ceph: ensure RNG is seeded before using "Jason A. Donenfeld" <Jason@zx2c4.com> - 2017-06-05 06:00 +0200
[PATCH RFC v2 2/8] random: add get_random_{bytes,u32,u64,int,long,once}_wait family "Jason A. Donenfeld" <Jason@zx2c4.com> - 2017-06-05 06:00 +0200
Re: [PATCH RFC v2 0/8] get_random_bytes_wait family of APIs "Jason A. Donenfeld" <Jason@zx2c4.com> - 2017-06-06 01:50 +0200
Re: [PATCH RFC v2 0/8] get_random_bytes_wait family of APIs Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-06-06 09:50 +0200
Re: [PATCH RFC v2 0/8] get_random_bytes_wait family of APIs "Jason A. Donenfeld" <Jason@zx2c4.com> - 2017-06-06 14:30 +0200
csiph-web