Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3075397imm; Sun, 1 Jul 2018 11:40:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcbUXVIvelF+15nixf+YQrNZEd5Ad9XCsZGq5y4KP3fwoDRk0WHNdD5Q1NSxN/0MrQ+Vw/z X-Received: by 2002:a65:5bc4:: with SMTP id o4-v6mr15712864pgr.448.1530470451163; Sun, 01 Jul 2018 11:40:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530470451; cv=none; d=google.com; s=arc-20160816; b=NU4JI/biFTic+VbHcbjPeZjw31ZfQypqPpUzQdIQgQTFyNHvVTtulZErIft4O4aVK8 5NzsawSjS45a0LsmtfxLgdFZ1iM/YS+VyxMAwxJiKFuOvmj0axBALNmQKyFpP7957zTg qGqsp6F75b+mb+xmtOW8PkwOSZlVZj8WfeIPH0E2KWYACvfqtRibBeOXXMTbD0EHri4j GHE1Mc/nbz/1EsyKajJQtTbbGttfSP3snHUE1VYu21QW3QvofBoXed6IEl1rLI1NH/Hf mmX7MSGSILOmbEgnpXA2y3GTkKO4BPV/8jBgPk6zc1MNL8ZsIK69p4lDIIivueIwckzg CLaA== 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=LtQq/iUzsoluYamcVa4G0Vb8u/X+0ItsVnYNGQSdhec=; b=q1ewk3TYQWOgDf3C96KiV0+9sMaDVLqwto5ZpVH+SsRNYl8kbDF8b2kG9HybOky+/s otJlrnz1T28t49/LtXvM0XcVybWiw/XmI9TnTqfs20IuKbHyCVGw66qxO3D2OXbsYcy8 DCgAzH6PYm9mzY/oMS4UU+Qmydzn6F7zYBbP5FBCvfBUme3hewL5EmxBm0nUPGu4IelT Auz5l2FOFOjC0d+e4xFKk8Who9n+5NjEaJNKbFkhO2+72o6Wn2px60/4p2Uajsu/fiEF b1sRSElnhtepIdJmQnGknU/lgYIInEHfWNiqOHAc7l99leyFGU4vodrl2cE6/I/Sz8wl Iw3g== 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 f7-v6si6050629pgo.234.2018.07.01.11.40.36; Sun, 01 Jul 2018 11:40:51 -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 S1753154AbeGAQOi (ORCPT + 99 others); Sun, 1 Jul 2018 12:14:38 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60366 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932811AbeGAQOd (ORCPT ); Sun, 1 Jul 2018 12:14:33 -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 666C94A3; Sun, 1 Jul 2018 16:14:32 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dr Silvio Cesare of InfoSect , Kees Cook Subject: [PATCH 3.18 81/85] video: uvesafb: Fix integer overflow in allocation Date: Sun, 1 Jul 2018 18:02:39 +0200 Message-Id: <20180701153125.591292918@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701153122.365061142@linuxfoundation.org> References: <20180701153122.365061142@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 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kees Cook commit 9f645bcc566a1e9f921bdae7528a01ced5bc3713 upstream. cmap->len can get close to INT_MAX/2, allowing for an integer overflow in allocation. This uses kmalloc_array() instead to catch the condition. Reported-by: Dr Silvio Cesare of InfoSect Fixes: 8bdb3a2d7df48 ("uvesafb: the driver core") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: Greg Kroah-Hartman --- drivers/video/fbdev/uvesafb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/video/fbdev/uvesafb.c +++ b/drivers/video/fbdev/uvesafb.c @@ -1059,7 +1059,8 @@ static int uvesafb_setcmap(struct fb_cma info->cmap.len || cmap->start < info->cmap.start) return -EINVAL; - entries = kmalloc(sizeof(*entries) * cmap->len, GFP_KERNEL); + entries = kmalloc_array(cmap->len, sizeof(*entries), + GFP_KERNEL); if (!entries) return -ENOMEM;