]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
cifs: use get_random_u32 for 32-bit lock random
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 8 Jun 2017 00:42:50 +0000 (20:42 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 20 Jun 2017 02:06:28 +0000 (22:06 -0400)
Using get_random_u32 here is faster, more fitting of the use case, and
just as cryptographically secure. It also has the benefit of providing
better randomness at early boot, which is sometimes when this is used.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: Steve French <sfrench@samba.org>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/cifs/cifsfs.c

index 9a1667e0e8d604ededf2a7ceb27ffcebf24b0ab9..fe0c8dcc7dc7c7fe24d7a5a175515837e8b1c3b4 100644 (file)
@@ -1359,7 +1359,7 @@ init_cifs(void)
        spin_lock_init(&cifs_tcp_ses_lock);
        spin_lock_init(&GlobalMid_Lock);
 
-       get_random_bytes(&cifs_lock_secret, sizeof(cifs_lock_secret));
+       cifs_lock_secret = get_random_u32();
 
        if (cifs_max_pending < 2) {
                cifs_max_pending = 2;