Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2995793imm; Sun, 1 Jul 2018 09:58:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKvktcC70Q31f0uL9oveAVL68yWyOGSVKxC9iNAbqoSJkyFPUYkmYyj8tInxBYWgdYfN7ow X-Received: by 2002:a17:902:123:: with SMTP id 32-v6mr22255460plb.181.1530464292410; Sun, 01 Jul 2018 09:58:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530464292; cv=none; d=google.com; s=arc-20160816; b=Lv2yUms68gEFlq/Sjvok7nMb9q32HkeW2Lu7Kmq0ZEOsG9FMcm29VJnB1J6rUOT9Li +W+AZM+f2bzbgmFmR1rtncffbprUbKiT5WXGfsAdBX4jMSlF3V4CzfxNb5oEi+Ywn/4V JvDLw5lHaWJ90q+irGGXlcHTyCW7ESZGtmJ4R+hxYNjKnu7rMAWW94nu5WrMQk0PVzRM LuDuR4ohxl0z/E1beUxqFoAl0uZfWhe1oBgp0WQtduqC+LFj3ROJJlDIkvhQOcwdAM1b mVRGO0NUfc+12d7QhUdJDeUEg6h9TOFL1JXZau5mrAosW48+o3plJNpfk+V1CEVP30WW pykQ== 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=v5YE6OOrxYPibHeW3PU/cld3JFVhukPLV/l3pDtqY4k=; b=qB3ibA8SlXBMhSFaiR6HUwO2MARKFGkEcdgCYDGI92GR7QCj6jv/3Ec5MCV/FqEp4x PScl9USw+dzvln3/Zol6b4NSO/mjWlpYWCdEPlBQldlY8hXG6DdBNXEMZbjcSf4ZqSMM yypBaZRRd16qrjX54WvI6SUeNyylWTe3ITM7jrwCv47rPcny25nQ/SBrzvm3ThLJcN7R 3EtL4xjCYQVmkWjdVqOrDZhko2iOpcnVFZYuBVeQAL++sg8FwQ9d1pIOrx2uJhIdwpND QdvAsy6fk9iJI5SJVToxWAc47N4oXL4E7k5kiYLL2tS4Owevk02qFAzFH1cKd4aG4rWQ EFoA== 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 x7-v6si12223153pgb.297.2018.07.01.09.57.57; Sun, 01 Jul 2018 09:58:12 -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 S934146AbeGAQzf (ORCPT + 99 others); Sun, 1 Jul 2018 12:55:35 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:38150 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933988AbeGAQpD (ORCPT ); Sun, 1 Jul 2018 12:45:03 -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 2FC90A73; Sun, 1 Jul 2018 16:45:03 +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.17 184/220] video: uvesafb: Fix integer overflow in allocation Date: Sun, 1 Jul 2018 18:23:28 +0200 Message-Id: <20180701160915.900637503@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160908.272447118@linuxfoundation.org> References: <20180701160908.272447118@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.17-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 @@ -1044,7 +1044,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;