Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6033514iog; Thu, 23 Jun 2022 09:59:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sO/zaOjvUp3ArE0pRLAwj1JzlV985ZNh9oge2zwJlZXOr0QE6dNT5sN49O6vETnGZaNFLi X-Received: by 2002:a05:6402:50d2:b0:435:8c44:8715 with SMTP id h18-20020a05640250d200b004358c448715mr11793702edb.49.1656003563430; Thu, 23 Jun 2022 09:59:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656003563; cv=none; d=google.com; s=arc-20160816; b=SwvUFCFPBKHuSvruE1S6U4XY0hGueeQjaXKSpfb5aiT+cgCN5tkMr1c+Uu44OKIcby qYDPgko7VKsGSwawpUG/vVt3WTbc6gKMl9opMJxnJ4dwH9zGyGW+FaNeuzUFDEjBW6cW cwPE/GPlqHf+2lxa/pQ0K8JHRAX34dWh/orFuRfpIsFiT0DUeNDPfVbXkWMOfxosIjj0 5ei/+DorU7IdmTFv3W0zb8yh1cEv1hGymP14v/0JYfb5zALlygLau8Hgs0CHsKmViCxG L0BzYTJcGGvBH4KtmFz++RYa6X1RaKltfhYP54AlgSQLIUjBVqRsqWl7ZZmBAwzag84J UAmw== 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=ZeOaWRWjZpF03mTWhkznUcraylwpJqmhNfYytIww7hI=; b=lXY/r8IWsSKvuOOxHjjGT1kY+1uSId13MeAtjOiaVXDyE4XR9SOLDLbFP4jMGWDXFy BHnZnfq+yHhl20kr9cznLvpAKTNy/LNljd356AvWiO2mq3S7Cl4T4O0JNRgbZJEz/sap ZEeLHFsX0GwO/Oh0oBOtOoGFpHUjheN3dANmn467aOqkQ12AtGtbp6IakpHjUKqyQaW9 xCQgtnU+u2b9uD0sXZ2DHzgIqmt8xUXYYkYFtNL3LkryRcfzkTfjMVBhjjVTzGszvybp 1CG5ONGsDJsIY/IQxtvjNRc1rzgOcm2fAMkE3eEll+a+E15HF96Jrvv0HllzDDiGweYj LmGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jztZe2fp; 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 nd5-20020a170907628500b006f395a10e8fsi12754382ejc.594.2022.06.23.09.58.39; Thu, 23 Jun 2022 09:59:23 -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=jztZe2fp; 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 S232349AbiFWQ4e (ORCPT + 99 others); Thu, 23 Jun 2022 12:56:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230234AbiFWQwW (ORCPT ); Thu, 23 Jun 2022 12:52:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05208CC0; Thu, 23 Jun 2022 09:52:22 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 8FEB861FC2; Thu, 23 Jun 2022 16:52:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7044EC3411B; Thu, 23 Jun 2022 16:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656003140; bh=EWV0K9b5FI8ijcInq18884BVp+zCSg39CPByOA5yjw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jztZe2fpqlk+6JSyDpYTeJuJxgMpMeJ7wEgO+/BJKLesoBPzx3oZZ7zJwNX6ADDn8 MzSrBbPYQfv9iFWaJRSN0nydRC5pU294JqrYFy2BIS/XkaPWRFnuhXShuPe9+4kCi5 QArh51AIFyQJjFDg0y3PPPfum/QgrzsKZCKBekNs= 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.9 144/264] random: check for crng_init == 0 in add_device_randomness() Date: Thu, 23 Jun 2022 18:42:17 +0200 Message-Id: <20220623164348.139924650@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164344.053938039@linuxfoundation.org> References: <20220623164344.053938039@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 @@ -1016,7 +1016,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);