Received: by 10.192.165.148 with SMTP id m20csp2488379imm; Sun, 22 Apr 2018 08:04:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx48xmz2AJkR/mf8NUdjK6PkkeVw/HMH6qJYTLMgFm6kuT/E1nQ3q0ebc7F3CMHUua9o/7MkY X-Received: by 10.98.16.142 with SMTP id 14mr16731763pfq.22.1524409472423; Sun, 22 Apr 2018 08:04:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524409472; cv=none; d=google.com; s=arc-20160816; b=E5pR92Nh80hcrIOPQE1GTT5O+XY+n7UZoGYyyP1YLykabLkY+V69c+mYdKPPJ6RGWI KviQ+DAYwwtTr/CQkR2pqQI7kkVuHS10ysN9wpnlji5OBuV0uCTFOekIEdLM33aj8+l9 2NN7Hov220vhBcyhJTkkSLyaTc803oLByjA3gwbMbFfINPlnja04utfvRiBoiDZ8Ejot mC20s0qaae+SEJudNKKz6Of9jarfhQBkjsIoKuihBTgk3+Pjc4H1n6+uP/Abz89XFJPg NxYi5/+vmiG7ZpJ+Nd7wnBMO8Q9/eOlJhPi2FN/UYrPbflr8zQnYJX/N8UPnHJaH2CA7 RIzA== 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=Qz/hJ9fGT15w76ppQaxZbPZ/4tF+/y0vcfZhI3F4Fq0=; b=Y4OhZFiFEiANsVKm9xAHxPjYppvk/a9BxN8ZG6BlVlNMl4dCZME7g+BG48YI/yO+wu JLPe1MOlkIPgvbjU1NN8s31/WAPRuLX7VMewy0S5wG7Bx1ZtU81euEEbFrVWEfbOD1mf TX26F7h6J14CN0zoE7tC3HvkIliWcAn1iO7KRJsz0gau1fSbYecEDJpyJTxsLh8+xVmc o/I6+Hly6sOGwJBOfPo0TjFpMpKoE4kclyS7j5o4F1MEEEzyob+HNC10wEK4Qp/HF1/W V/zy2UvRfB0+6TsucbPXJbCLERpD9qoY9C+TbGrlBa5/chkApGbMuF6EJOArDhRGss9G 9T5A== 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 m6-v6si6675781pln.382.2018.04.22.08.04.18; Sun, 22 Apr 2018 08:04: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 S1756652AbeDVOMS (ORCPT + 99 others); Sun, 22 Apr 2018 10:12:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54904 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756624AbeDVOMN (ORCPT ); Sun, 22 Apr 2018 10:12:13 -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 326F8C3D; Sun, 22 Apr 2018 14:12:12 +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.9 33/95] random: use a tighter cap in credit_entropy_bits_safe() Date: Sun, 22 Apr 2018 15:53:02 +0200 Message-Id: <20180422135211.789036774@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135210.432103639@linuxfoundation.org> References: <20180422135210.432103639@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.9-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 @@ -741,7 +741,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;