Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6137161iog; Thu, 23 Jun 2022 12:07:22 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t9lfBW3RKdT9X7mXY5MnPgNvYoxCtc0dT5p+p9vAs/LUrsDaFwOAK0HY2QHedin4AYZ7fX X-Received: by 2002:a17:90a:6043:b0:1ec:c929:d16d with SMTP id h3-20020a17090a604300b001ecc929d16dmr5419496pjm.7.1656011242683; Thu, 23 Jun 2022 12:07:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011242; cv=none; d=google.com; s=arc-20160816; b=yaw2boCS/5qJXL+SyuMa2tFHdcA1OFwK9OodzmkcUm9ji1BZLfqh/G/AraASoFcr3e 49cqS3+4oLgLi0vGUkA51Cy8XPbEjx1YgXZQ3ZsHcH3yFm+MZXUu1bAGdufAmIyyNxnE 821bXqIKl8FrSUKRm73UJ/0uvMngjSXRqsd1du7HqFhyTSjcQErh+bfPy/qabVf6jj6p KWaqeJk5jg40UT1LFygxbSm8r9MoOjo2VlkERQBasbBSrz5SvIFwKzFJC0wEuY5IO+6S vQY1uS3ONMaa0FWMQ3dd5DspTV+8SxG5uG9Hvi8q3Y3t3mqRWpkSBWuxRuRgV1Xyk6tc qYCg== 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=WNzNlpmrgjA0VwpTgYzV+m6tALLcsEEu7lgn/foMz1E=; b=FtFh7H3KMq0RQAXf5ABLbtoQOQNu3c1UFZInTN9yK+tfRcEt4juI+OYA8zJWLaf441 FHg/VXLq7py9uyGVD/FP4b/WjYgCdY7CnAI/hqsguTJNTbwgGlNME83lJnv/4dS7NgQj K+4q8KSiliHyQ1DuNH84CdSf9CEOcnzAsNc6E/bDHaeLwpB0VKgNczmQTHVXRvrAbuDr RC/Wfg9qmS8Ro/hA7ft95KBJlTt1iXvomj+a//D72Sfpzrd6h5/7gAdc2a+BFS2qTIA6 Tg5XBZa1pvm+KaoVt0J9t6fTfXlzc8lo3wUEvDE2WopTNv9xEbDyrYdZqRGNfs9lF/3o QPHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fsGwtIqE; 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 t6-20020a170902e84600b00153b640ed90si472435plg.38.2022.06.23.12.07.10; Thu, 23 Jun 2022 12:07:22 -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=fsGwtIqE; 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 S236405AbiFWSKn (ORCPT + 99 others); Thu, 23 Jun 2022 14:10:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236373AbiFWSHo (ORCPT ); Thu, 23 Jun 2022 14:07:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F14B8B8FB4; Thu, 23 Jun 2022 10:19:18 -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 23C5561E6C; Thu, 23 Jun 2022 17:19:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10D86C3411B; Thu, 23 Jun 2022 17:19:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656004757; bh=YVFCm9IvwmgkDNWZPZYSkH8bYCAZpNilJPeiWNu6Xuk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fsGwtIqEVav9L8OOGsCTb5XOrQ6SCOuoQf+3SuBRL2RMPHuUqyxZSxUdlpMrluap4 boFNXtXKZ9r0XrJ4VnfOIQag1VoYLb4Zm0P/3o8+9hXBjliA1h4KRVFpCu7RrKSQqO rS8uu5rAm8ytk6ui1jKsOfIDR5BJAnQ4mAfKLj70= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Arnd Bergmann , Geert Uytterhoeven , "Jason A. Donenfeld" Subject: [PATCH 4.19 141/234] m68k: use fallback for random_get_entropy() instead of zero Date: Thu, 23 Jun 2022 18:43:28 +0200 Message-Id: <20220623164347.046661336@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 0f392c95391f2d708b12971a07edaa7973f9eece upstream. In the event that random_get_entropy() can't access a cycle counter or similar, falling back to returning 0 is really not the best we can do. Instead, at least calling random_get_entropy_fallback() would be preferable, because that always needs to return _something_, even falling back to jiffies eventually. It's not as though random_get_entropy_fallback() is super high precision or guaranteed to be entropic, but basically anything that's not zero all the time is better than returning zero all the time. Cc: Thomas Gleixner Cc: Arnd Bergmann Acked-by: Geert Uytterhoeven Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- arch/m68k/include/asm/timex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/m68k/include/asm/timex.h +++ b/arch/m68k/include/asm/timex.h @@ -35,7 +35,7 @@ static inline unsigned long random_get_e { if (mach_random_get_entropy) return mach_random_get_entropy(); - return 0; + return random_get_entropy_fallback(); } #define random_get_entropy random_get_entropy