Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6146679iog; Thu, 23 Jun 2022 12:18:27 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u12D6CTwLVQ7wG87shHFmS9eopKnVLq/lU2E1kS/s+//u3IeVSGtymi706pOPBA2eqi81q X-Received: by 2002:a17:906:b18f:b0:716:89ce:a724 with SMTP id w15-20020a170906b18f00b0071689cea724mr9641868ejy.390.1656011907359; Thu, 23 Jun 2022 12:18:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011907; cv=none; d=google.com; s=arc-20160816; b=UcZpbIZzOmHgCIWYIq3jvgFxcV4NwNiJOMXYTVOs+YSwQLpL6xTnp4zLSa2+AUDAMR GlfO/hFr3uLcJebPC6iUv58mIR9eYLtiv4el54hEU6S1LTaDt6Sv6PKrKSbqnGq7LiHP tHXuRNSCkgE/L+ield7M0GFse9EM18XYeWAqCBhOMxqdz6fTn3Tk5KCRMPsOEs+33aOQ 0+cUwYJODTvHPH8Btc59hfhg41mw3pXqQKQA3qX349Umz1xLZuWhlsrNqHmRmQ7VLjnp 08vEeJB21Ul0YrkfvpwbLcOO1FYGb5vOpNrxJIOM2LRwno9dCQae9HgtcJOhNrjaRD+4 Xklw== 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=s1nGdCCHNxx0riJOFYrNOYFi9Zt9gT2Or3O/AFmubXo=; b=LcIbodU+FzuGNvL3GY0HEns7Ub/4Wfeus8YBF25H7mG2XCxC/OL6ac7j+4FooK8+2A SkRaao/p2bxN1C3NeqVpIG5PHACnN1ld1yc+2ZQWqW79zDqNobPvrdylIrrPigx8HWXX SxwKQantMDNHcErM4YMHuzq5RnZfAoylqfq6N27N1L/0t/pAZzGhmgapolCdrmr3gDzC 1Rouy0/1qqnRNDz51Zt4jun3mhOG3Z6rcK3567p9UCrH1PAaTejAQ78+veL5RKVHwTw3 gBwzzH3ctbjtzJMnA+wBXdVeKyzuciT02XMTuUqTGe4T2NalSGx1wMh3J9xlJM05VE+x I/NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="OK/m77CF"; 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 nb36-20020a1709071ca400b00722f72e1c15si8123513ejc.428.2022.06.23.12.18.02; Thu, 23 Jun 2022 12:18:27 -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="OK/m77CF"; 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 S236019AbiFWSGR (ORCPT + 99 others); Thu, 23 Jun 2022 14:06:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235901AbiFWSFg (ORCPT ); Thu, 23 Jun 2022 14:05:36 -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 CF48B88591; Thu, 23 Jun 2022 10:17:42 -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 750ADB82490; Thu, 23 Jun 2022 17:17:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF670C3411B; Thu, 23 Jun 2022 17:17:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656004660; bh=A4x+li2UE3GtKI9uqmdD4/5h/twgrgp5JtGXGyfRAQM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OK/m77CFtbMy1eTdJQrQzWRgb7O7QUmsf8+DNjpmqit8HPo+WOOSNdYH6EE9DeJRK BMr6M8gxop5DWsXiPbOVy3dxtSmaQPrc6GsKaH8SdgNW39PbrrsjvM+a55HWu3YBG+ ES5Bnn8mr6pWA8mN3Gq5nYtRg1H+JR9HpvDJPpHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , Dominik Brodowski , Eric Biggers , "Jason A. Donenfeld" Subject: [PATCH 4.19 108/234] random: check for crng_init == 0 in add_device_randomness() Date: Thu, 23 Jun 2022 18:42:55 +0200 Message-Id: <20220623164346.113835771@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: "Jason A. Donenfeld" commit 1daf2f387652bf3a7044aea042f5023b3f6b189b upstream. This has no real functional change, as crng_pre_init_inject() (and before that, crng_slow_init()) always checks for == 0, not >= 2. So correct the outer unlocked change to reflect that. Before this used crng_ready(), which was not correct. Cc: Theodore Ts'o Reviewed-by: Dominik Brodowski Reviewed-by: Eric Biggers Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1015,7 +1015,7 @@ void add_device_randomness(const void *b unsigned long time = random_get_entropy() ^ jiffies; unsigned long flags; - if (!crng_ready() && size) + if (crng_init == 0 && size) crng_pre_init_inject(buf, size, false, false); spin_lock_irqsave(&input_pool.lock, flags);