Skip to content

Commit ae5b806

Browse files
zx2c4tytso
authored andcommitted
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 <[email protected]> Cc: Ilya Dryomov <[email protected]> Cc: "Yan, Zheng" <[email protected]> Cc: Sage Weil <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]>
1 parent 6787ab8 commit ae5b806

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

net/ceph/ceph_common.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,11 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private)
611611
{
612612
struct ceph_client *client;
613613
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);
615619

616620
client = kzalloc(sizeof(*client), GFP_KERNEL);
617621
if (client == NULL)

0 commit comments

Comments
 (0)