Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2971272imm; Sun, 1 Jul 2018 09:25:43 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfU58TfXl6/AteWWg4oAKF9g3WldfuNWEfPBgtsR4stSG5zU8+hydzGDxsCUlCutxIWMn+H X-Received: by 2002:a62:6698:: with SMTP id s24-v6mr22232340pfj.243.1530462343067; Sun, 01 Jul 2018 09:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530462343; cv=none; d=google.com; s=arc-20160816; b=HviRw9RWSUxi7ZergHDI86trBhASLJHveH+vVQ3PKO3mKmIYZl5Ubiu10uqVO7xbkd j9puEYVUL0MUDGtmslTXk/EQ/UMntJSfGNvIi5MdjpgTqyuNh0fdHEWHGpyCDh9ujm56 nHG9P5tjM7yNWA9UgU5VQYkfUg+ZWFaYe8hM+dnE/9LUgvWTgaNwOgv5lctx69PDOSSt KGoe1ourIupHS2fe192f3mbNE+1HvMHyzGk6dhEas3KMItVH30+qAsAAZbM7aTdhgHCJ NlINi+dbto9v/ahecVWj4kt6+UpSRljgW1smPD7qTib7P8eq5v83+esX4Sv8tWGmH1DA DMIA== 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=qRmpua9PLck2kRKEVRkojTwNR18cUK8RPOuj8zs044c=; b=ys0Jz3On0NJmxYUcnIg0nuJFG7s5Iw0GgOOFEBAUtaQoGrAVvEO+iWj1/ybAzbUAOm biykTx8yvLyYOYB0HNrU2gjj8tpAc1xyqQ6EDweKRYCYnWIydhM3I68s1cN6qWBTbtPE E+DFzS/9ZBu8MPR9So75eOPprs4sOGRKYd+2Bx/LyFg3wS0AvvwcWLgx4Mx/r/IaF3D6 7kySxbrdeqNTQOGwZE81XlBolC5RGmvqNz1hsBprS+yWZjXtusyOvbH5ikkN6AJjOgyy z9j1Gdy9yvv1AYYT4vny+uMHEseLcnCOiGqHbkruK8hep45LPcAznZivfhUD2w35lw13 US6w== 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 s2-v6si14173854plq.372.2018.07.01.09.25.28; Sun, 01 Jul 2018 09:25:43 -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 S965047AbeGAQYC (ORCPT + 99 others); Sun, 1 Jul 2018 12:24:02 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33142 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753468AbeGAQTI (ORCPT ); Sun, 1 Jul 2018 12:19:08 -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 47C0449B; Sun, 1 Jul 2018 16:19:07 +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 4.4 092/105] video: uvesafb: Fix integer overflow in allocation Date: Sun, 1 Jul 2018 18:02:42 +0200 Message-Id: <20180701153156.040752536@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701153149.382300170@linuxfoundation.org> References: <20180701153149.382300170@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: 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;