Received: by 10.192.165.148 with SMTP id m20csp2433457imm; Sun, 22 Apr 2018 07:02:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Tbi8e2erS72vbMez9y/qlKsRMCOYDc4NkZvpj+Ukb9l5w2m4p5AtQvC7OVa9w6WqV5eob X-Received: by 10.99.181.89 with SMTP id u25mr13860788pgo.302.1524405752562; Sun, 22 Apr 2018 07:02:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524405752; cv=none; d=google.com; s=arc-20160816; b=S9UA5SiXzFW2eKwW1R3/lCY/QnFWcCzOGgtTZNwLufOsID2/BlP55YeXIm7SOVwBRo Apcw+vZnW2A/fep9TkU6IFDMXoxWRGbnzZd1tdpftLoDr9mFY4zR/6TwDlnpwwpXlE85 XPGcVyfwVvMukGiuis208mafvNrm0M8ROjboID9H6NfcmxMh+xK6zqBDMtfgylDaDUZs xeCjkzpZMrMMVxxNOzjnreWOaodHAEbtusCR4Y+VK5UdoE8Gfnpgc5nqcp35y4SRgtsn kv94l+OtgLQpMYOwWXHbP1jj8RiNqrJgaqoRAQEv4+lbXq8Z+rzbXTdC+as56sMexK4r hYKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GD1lhrV3Q9scGgWu4kpDs8syjfrptmAASjaLhE7vLhk=; b=sLziDG7wKqDnOAUsgKTHg1CZ/uIlgPEg/U18iSpQmm7RwTEwEORKxjRJYKxdtMpc9h pfTmw+elA0Wp36dz14wTBK4VIG/WHJ8Qmm1rwU08/w7KV8d9wDYMWVAgJVe5XEBeZ+RU EInStDb00BhjjYLhSQzAKoZo9G0Jif7OcXYD8jlHaXycaTz1lNKWbNFBVCzL/6J+xhnI nWct3HCsbmlcRCElQ01nNtfMXoLe27kmbPWEVXCM+7MOYwIFOjn/O2R2iogzKGjGupVP cKyRmlN9bPrO4NYkuQtDgd1PCqJtiUujcuOXOygYv4r3x0J4tZA2PH2kFLubWs96stGc r6CQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g5si2922268pgc.283.2018.04.22.07.02.17; Sun, 22 Apr 2018 07:02:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754486AbeDVOAB (ORCPT + 99 others); Sun, 22 Apr 2018 10:00:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:47142 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754464AbeDVN75 (ORCPT ); Sun, 22 Apr 2018 09:59:57 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BF09D9C; Sun, 22 Apr 2018 13:59:56 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , Chen Feng Subject: [PATCH 4.16 081/196] random: use a tighter cap in credit_entropy_bits_safe() Date: Sun, 22 Apr 2018 15:51:41 +0200 Message-Id: <20180422135108.495597846@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Theodore Ts'o commit 9f886f4d1d292442b2f22a0a33321eae821bde40 upstream. This fixes a harmless UBSAN where root could potentially end up causing an overflow while bumping the entropy_total field (which is ignored once the entropy pool has been initialized, and this generally is completed during the boot sequence). This is marginal for the stable kernel series, but it's a really trivial patch, and it fixes UBSAN warning that might cause security folks to get overly excited for no reason. Signed-off-by: Theodore Ts'o Reported-by: Chen Feng Cc: stable@vger.kernel.org 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 @@ -732,7 +732,7 @@ retry: static int credit_entropy_bits_safe(struct entropy_store *r, int nbits) { - const int nbits_max = (int)(~0U >> (ENTROPY_SHIFT + 1)); + const int nbits_max = r->poolinfo->poolwords * 32; if (nbits < 0) return -EINVAL;