summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-06-07 22:44:54 -0400
committerTheodore Ts'o <tytso@mit.edu>2017-06-19 22:06:28 -0400
commitae5b806a3d3c23d9d3b57aecbe687a0bd82ab086 (patch)
treeb5d8eb3b6f2d986cb3733ad19561a63961de0f93 /net
parent6787ab81b29115b6d2e7d17fe8a8017da66197d6 (diff)
ceph: ensure RNG is seeded before using
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> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/ceph_common.c6
1 files changed, 5 insertions, 1 deletions
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)
611{ 611{
612 struct ceph_client *client; 612 struct ceph_client *client;
613 struct ceph_entity_addr *myaddr = NULL; 613 struct ceph_entity_addr *myaddr = NULL;
614 int err = -ENOMEM; 614 int err;
615
616 err = wait_for_random_bytes();
617 if (err < 0)
618 return ERR_PTR(err);
615 619
616 client = kzalloc(sizeof(*client), GFP_KERNEL); 620 client = kzalloc(sizeof(*client), GFP_KERNEL);
617 if (client == NULL) 621 if (client == NULL)