Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6137809iog; Thu, 23 Jun 2022 12:08:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1suV63nNyLXIZ26tKnvYdpc7z73RzI1OduFnJcKYEWSnZKja4f6szDWLlGcY0nxM/xXRSPQ X-Received: by 2002:a05:6a00:2447:b0:520:6b82:6dfd with SMTP id d7-20020a056a00244700b005206b826dfdmr42155326pfj.39.1656011285857; Thu, 23 Jun 2022 12:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011285; cv=none; d=google.com; s=arc-20160816; b=KK9C9Ze4rW/bczzva1ypTnIeSe4dEsljtVPerR+qB6KvMyNNr6Qk7tZMPRQSJyDiWv Jd82BE58Bq2Y2SxQEklqjs7QeGK1mPd9Na3hWIE3kR9rMwV99lP+MzqeBveEeY6vcBKK sE/FxNkndh2KRed5p+1GuEq1DLEUyMBIM6mJrqqmV+WorNccRSWUjm9B53NhgaAoYTPL LPz2k8rUrEB2CGaI6DiCgeU83XOyGwH2csJ5AfdvbqflWSq4dPVx0xbsFdN8nqo7kw3d hwDA7e0kFznYMRAgFTHCTnI9rgG2I7v57skXCJ8VZUKUsMNM/yMzFOxTQ8CVeSDK6oHj v6IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/ttFFxNRmn1VNvvjoOvcjMg0E9ce9EWmfVWbY3lVh/w=; b=FBsbq/P1PSzzKg8/+M+nTHHD418NLv+0khfFJtzPhQyraMBsulD/e11qUKv904SXkx S7ZBHqAf7oPlSIeJ+/+JjxinXPF2hlMSEiAxNx1M7O9+VV6gWso2o7lt+385eZpUSc5r WVghCa2uYCZdmv8BplgEBS+EFthWkzRI+9pD8SWCt70eqmnhrSA4+Dk++MhkL5BI1KLZ pITBrzq5GntCF+861VAsFys3e80r+Bw2T3MtfJ6ot0Dwwz2BP3r8/RUaTnR6wk5+EDYQ ztA8eDWAFrVswvFRmkX7prrdH/oXC4+Wzr/xAgyI6Q4t+7clEA0KHv0Vj4iaVWr106JB KQOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KyuPSRrR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c3-20020a056a000ac300b0050d932fc7b4si31955080pfl.185.2022.06.23.12.07.54; Thu, 23 Jun 2022 12:08:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KyuPSRrR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235844AbiFWSEV (ORCPT + 99 others); Thu, 23 Jun 2022 14:04:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236011AbiFWSC5 (ORCPT ); Thu, 23 Jun 2022 14:02:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D770DA1F1F; Thu, 23 Jun 2022 10:17:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 70422B824B9; Thu, 23 Jun 2022 17:17:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD145C3411B; Thu, 23 Jun 2022 17:17:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656004623; bh=Wf5YjyGS/Miwbxm5fWl0FgB1C4SqltlK0Q2dh7YVefI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KyuPSRrRzomldTgxabHq1cwz2dXjyf9WOUwy3g3HPJKTyYpIlRPW8p2i660Fo5RU2 asil3gxaEHlZ0ldLYz2dX/7nX/BH2ltUlpdod8I+Nj0X9BgtCuAWHC1VXc42bHTGkh 8sS/CyMWo4HzXpHTnFnXjgRMA6JUamCkLYd3lE3c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Biggers , "Jason A. Donenfeld" Subject: [PATCH 4.19 080/234] random: remove use_input_pool parameter from crng_reseed() Date: Thu, 23 Jun 2022 18:42:27 +0200 Message-Id: <20220623164345.322676690@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164343.042598055@linuxfoundation.org> References: <20220623164343.042598055@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Biggers commit 5d58ea3a31cc98b9fa563f6921d3d043bf0103d1 upstream. The primary_crng is always reseeded from the input_pool, while the NUMA crngs are always reseeded from the primary_crng. Remove the redundant 'use_input_pool' parameter from crng_reseed() and just directly check whether the crng is the primary_crng. Signed-off-by: Eric Biggers Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -365,7 +365,7 @@ static struct { static void extract_entropy(void *buf, size_t nbytes); -static void crng_reseed(struct crng_state *crng, bool use_input_pool); +static void crng_reseed(struct crng_state *crng); /* * This function adds bytes into the entropy "pool". It does not @@ -464,7 +464,7 @@ static void credit_entropy_bits(int nbit trace_credit_entropy_bits(nbits, entropy_count, _RET_IP_); if (crng_init < 2 && entropy_count >= POOL_MIN_BITS) - crng_reseed(&primary_crng, true); + crng_reseed(&primary_crng); } /********************************************************************* @@ -701,7 +701,7 @@ static int crng_slow_load(const u8 *cp, return 1; } -static void crng_reseed(struct crng_state *crng, bool use_input_pool) +static void crng_reseed(struct crng_state *crng) { unsigned long flags; int i; @@ -710,7 +710,7 @@ static void crng_reseed(struct crng_stat u32 key[8]; } buf; - if (use_input_pool) { + if (crng == &primary_crng) { int entropy_count; do { entropy_count = READ_ONCE(input_pool.entropy_count); @@ -748,7 +748,7 @@ static void _extract_crng(struct crng_st init_time = READ_ONCE(crng->init_time); if (time_after(READ_ONCE(crng_global_init_time), init_time) || time_after(jiffies, init_time + CRNG_RESEED_INTERVAL)) - crng_reseed(crng, crng == &primary_crng); + crng_reseed(crng); } spin_lock_irqsave(&crng->lock, flags); chacha20_block(&crng->state[0], out); @@ -1547,7 +1547,7 @@ static long random_ioctl(struct file *f, return -EPERM; if (crng_init < 2) return -ENODATA; - crng_reseed(&primary_crng, true); + crng_reseed(&primary_crng); WRITE_ONCE(crng_global_init_time, jiffies - 1); return 0; default: