From patchwork Wed Jun 7 23:26:02 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: 9773299 X-Patchwork-Delegate: herbert@gondor.apana.org.au 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 B0EBC60234 for ; Wed, 7 Jun 2017 23:28:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A683B283AD for ; Wed, 7 Jun 2017 23:28:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B5382848D; Wed, 7 Jun 2017 23:28:25 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 39A6D283AD for ; Wed, 7 Jun 2017 23:28:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752890AbdFGX2A (ORCPT ); Wed, 7 Jun 2017 19:28:00 -0400 Received: from frisell.zx2c4.com ([192.95.5.64]:54805 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751520AbdFGX0e (ORCPT ); Wed, 7 Jun 2017 19:26:34 -0400 Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 58386a0d; Wed, 7 Jun 2017 23:26:00 +0000 (UTC) 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=YcJt8A1ymp5MbgBkCRTy94Gvsotp1L/oW8n/ wknGiDCL/+KeVLJkb9OfmMaNJpVCS4nEKH/wI7qhGSyrBbCccjofbfbsIg7urw7+ RhRQT7EfM8ZvoUczjaIVfOypx597KDVaPAbBvhquU3zFakaCLEidRRwveFwk6jEo bBqGryQMO70UVtMDE3Ce6W4D99/PGkgatZiRz/OM5rLlIRq1dbAY2IL4Zm87h6cu qylpN0+5bPrzE/Xj/YJyovW7AGTNYt3P19CrWfbO7RJOKOAzcfyRiCypSrxy2Xs1 Wq6q+OSMq0SG1gARRzBWz+pAxqiclZB12KOs+Jnofg07uSmwqA== Received: by frisell.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id a475b075 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Wed, 7 Jun 2017 23:25:59 +0000 (UTC) From: "Jason A. Donenfeld" To: Theodore Ts'o , Linux Crypto Mailing List , LKML , kernel-hardening@lists.openwall.com, Greg Kroah-Hartman , Eric Biggers , Linus Torvalds , David Miller Cc: "Jason A. Donenfeld" , Steve French Subject: [PATCH v5 08/13] cifs: use get_random_u32 for 32-bit lock random Date: Thu, 8 Jun 2017 01:26:02 +0200 Message-Id: <20170607232607.26870-9-Jason@zx2c4.com> In-Reply-To: <20170607232607.26870-1-Jason@zx2c4.com> References: <20170607232607.26870-1-Jason@zx2c4.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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;