Received: by 10.192.165.148 with SMTP id m20csp2472141imm; Sun, 22 Apr 2018 07:45:35 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+5vtHxjJpTb+g2N2QEdVMttcfW9SNVntkIABIUj/7xOAgXLu58JtU86fLdnLH5Z7pZ5C29 X-Received: by 10.98.21.73 with SMTP id 70mr16833266pfv.91.1524408335034; Sun, 22 Apr 2018 07:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524408334; cv=none; d=google.com; s=arc-20160816; b=g4pCNkKrLIdy/966Wn8a5Z6kHogZOYZ/49o29/jvZlqMSr5jLwfpTCb4w+ylprfNXw blWiU/wHueQbw0UhBWFtzdIHppiZzBre6rF8+La7JuBsX812iq4jUs5nzD3wlQ5O+vPh 4m26urP+TBO0WBOqmBcSUDp8rP3LFVVzYPQM7mcEfArmH+Wm/8xmqUTiPv3VoDLYeYiY 4uwLiIwcvSeiORS6JVeyToGG/U6UE0kLKIC0qqcp8quH9hxNDLSp8M2BTZknH2Lv1bHF Dc5e14TjC3HImzYKdz0kzME8Kwt3G/ScA0XCeWp4WFs5wTg+lvKV4tjCwWwJXihY2JZI LXwA== 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=8yduKWd0EI0Yr42teKAQstwzXWz8/6AQoLJG9z27XrE=; b=0dhzR4GM1++fJN5tfRgi7w/wrm9bwIbKNhuNIQKOVEimfEme2W9IroU8XJiSpqAVz6 DJW2nGSt0TWfQ/Ts4pJQp4aIZ6pbKmLt/xgbZDLvLkCBCFA1Rhc2X6z4Iv1Yd4VzK9qe zzXQToVhApFGdepQ90epb2ScBJcoP3sGBRODuprYP1L2WEhdQ4MQUk1FN596R6tlC+fB r7bSwRQ52EY9KWcZututjRDXlB6RbUCNlfxy2qiIJtmnLln4m1r4riRMs4DsngRW2ii6 T5JuqCWrdSZF7A6AdFEClKZuXYA0vO6QPAlG71CGS527CnEE1cWP4YkDMCpxjTixs/Ik a7yg== 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 i12si3012562pgp.119.2018.04.22.07.45.17; Sun, 22 Apr 2018 07:45:34 -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 S932434AbeDVORT (ORCPT + 99 others); Sun, 22 Apr 2018 10:17:19 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58046 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932380AbeDVORM (ORCPT ); Sun, 22 Apr 2018 10:17:12 -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 663735AD; Sun, 22 Apr 2018 14:17:11 +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.4 47/97] random: use a tighter cap in credit_entropy_bits_safe() Date: Sun, 22 Apr 2018 15:53:25 +0200 Message-Id: <20180422135307.931591836@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135304.577223025@linuxfoundation.org> References: <20180422135304.577223025@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.4-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 @@ -724,7 +724,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;