From patchwork Tue Jun 6 17:47:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 9769395 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2F54A6035D for ; Tue, 6 Jun 2017 17:49:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A96B200DF for ; Tue, 6 Jun 2017 17:49:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1F0B9205AF; Tue, 6 Jun 2017 17:49:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id E79F3200DF for ; Tue, 6 Jun 2017 17:49:41 +0000 (UTC) Received: (qmail 1967 invoked by uid 550); 6 Jun 2017 17:48:38 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 1680 invoked from network); 6 Jun 2017 17:48:30 -0000 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=from:to:cc :subject:date:message-id:in-reply-to:references; s=mail; bh=DYVL sJwYLQejfUT5vVb6z1ChjFg=; b=gkrg+aTaRK+a/7cUetCHt3UekfcWSoa41aIK VByGEywAqm7Wu5OWJ5MHLYFT6vCCgqk1INi71voS0Yuv7xM/azjreBAgacqIbD/5 p8SLZlFrlrQ7jpUUeChGPtGTqkG6IfId8dFbBzPP6IUUYVHiX4pOvWP7cNCL1mIu MUWOpMLeE027qXKchy0cmJ2qXdpZcmSbN/15ySWHNqItR0O1q1mPGam9Ytrre+H+ /w+NZmHI6sNMZQdf4yX4vTg/SdydyGsgckiQzP+LiL4cUhquPmcn3zOqafLDBMSh yF+XYpi7SXD+mIAC3aNv93roFM86DEe9lBNmQ0XV74qSP6xKFw== From: "Jason A. Donenfeld" To: Theodore Ts'o , Linux Crypto Mailing List , LKML , kernel-hardening@lists.openwall.com, Greg Kroah-Hartman , David Miller , Eric Biggers Cc: "Jason A. Donenfeld" , Steve French Date: Tue, 6 Jun 2017 19:47:59 +0200 Message-Id: <20170606174804.31124-9-Jason@zx2c4.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170606174804.31124-1-Jason@zx2c4.com> References: <20170606174804.31124-1-Jason@zx2c4.com> Subject: [kernel-hardening] [PATCH v4 08/13] cifs: use get_random_u32 for 32-bit lock random X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Steve French --- fs/cifs/cifsfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 9a1667e0e8d6..fe0c8dcc7dc7 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -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;