Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3051613imm; Sun, 1 Jul 2018 11:06:41 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdb4A4A6th8JFjmxVSRNQhvISmwLPLa51JlCTV1AAA+/as5g1EKjkV+sHBnyuDwpdGfbe9i X-Received: by 2002:a62:e903:: with SMTP id j3-v6mr22551781pfh.228.1530468401352; Sun, 01 Jul 2018 11:06:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530468401; cv=none; d=google.com; s=arc-20160816; b=wIEDt/nFd+i1oQqBcFFGdCdQ+Nx+jjmdIWF7PaYZ+STZmEn1b6eOau+aVN0iVb/1hI tsLuolSzR7lrzQMKZo1UkkKNDNMFjAU570OiK1tkPPB4aRxjkNOFb6+O1mUbR3LNwMzb CpZ3VxTCpd4SmYxQsD95T/G7jrslBW2KRf6sfmjdzjxKVvbb55eVvw3JFQ5UU52j/SyB PZa+lWh2g1CPb39SOmUR5uHeF47oQYjJGxujZ6+0rpU1V9oK0t2kai3484wGQcBpMson A5AQyPfPydPYlbtgeqe7SeqibfKKB49haz0xZ7e9gl2OSjXTT0f6uyitroIvWN0frP8h T1mA== 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=2foCN8nk4Mek1tfFwkRZ5XGD9wS+liajKGH3drZ/cZI=; b=kCNHDn7wI0Rsyd8KRa1egfYks98kA7zskgKQ1+B5qPveJX+u0Cw63G7NtKrctIpMSX LJ2P9Q0jcqqpjsij3sdy8FZSBxE7tCOlfqj0YJynP4ycgcFhJMVXrwEjxtmwqcZo+hPM 9FRFZxR3Lmr4DLK43Mse4/aoFuNNC5pUAcgpH37J/AeEJ2Ncm0W2u58coE0uyfUgE4j9 LrihsheZEovOdzIt1m/3VH66Imi+wgvNJvSDeOpn0IiMOWjhYAmFV6trP55MiRUB9GpY nfhJwbtlsc4ZmD7WvOCrU18KhefUdGNRV/lW0Vp5EIGqbe5YZkF39h6pHBgGsim9bfKb cAiA== 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 h2-v6si14587322pls.245.2018.07.01.11.06.26; Sun, 01 Jul 2018 11:06:41 -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 S965826AbeGAQ3O (ORCPT + 99 others); Sun, 1 Jul 2018 12:29:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34428 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965794AbeGAQ3C (ORCPT ); Sun, 1 Jul 2018 12:29:02 -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 CB4E7AD8; Sun, 1 Jul 2018 16:29:01 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauro Carvalho Chehab Subject: [PATCH 4.9 081/101] media: v4l2-compat-ioctl32: prevent go past max size Date: Sun, 1 Jul 2018 18:22:07 +0200 Message-Id: <20180701160800.408514509@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180701160757.138608453@linuxfoundation.org> References: <20180701160757.138608453@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: Mauro Carvalho Chehab commit ea72fbf588ac9c017224dcdaa2019ff52ca56fee upstream. As warned by smatch: drivers/media/v4l2-core/v4l2-compat-ioctl32.c:879 put_v4l2_ext_controls32() warn: check for integer overflow 'count' The access_ok() logic should check for too big arrays too. Cc: stable@vger.kernel.org Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -864,7 +864,7 @@ static int put_v4l2_ext_controls32(struc get_user(kcontrols, &kp->controls)) return -EFAULT; - if (!count) + if (!count || count > (U32_MAX/sizeof(*ucontrols))) return 0; if (get_user(p, &up->controls)) return -EFAULT;