Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp2995309imm; Sun, 1 Jul 2018 09:57:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdAJJ+Dtn+xHbHqCEdvFuU4sFZLXXiEX19LIkhfd/DFtkqvjfC9HKm9kK1a+cfKsnTvoSxo X-Received: by 2002:a17:902:ac83:: with SMTP id h3-v6mr15104251plr.17.1530464256945; Sun, 01 Jul 2018 09:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530464256; cv=none; d=google.com; s=arc-20160816; b=A8WENgWw0xzvn8axxu5juotiktxWQTxWovIyyT224efIh2REtd6pv2T8tVLioXseyZ U7gXIci3vwfO4Ayt8bSdaPbflk+nufkwmwCs+tU7XL4PiTJKY5XJKXnHnG/ruWB+nm8i WKyR4JgI80XemGPCk51Dt+vxskQokHwHXj4SA9moTir4u7ewJsz1urXfdAIGLyZNvWVt higr0QbARvVqcZmijdx+TCBZcwYWjDO/5ueIy9ZDG6t8sCQWIz66vxQa00pTbGw6yFM5 UtIBANMD8ArSkYLz36cenJv9MEDIl1Cp1pcLOia73/qMn8eYEfpisReWRHgpPRxAUWY+ tIZQ== 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=Rk1ts5uY85FpeXkR+VIxEQRUMGQkhi35+1pzZfzF6l0=; b=LXyLJC+hVrTW9rGziaZvz4NE7xlpt2VNUT/B583SOEqhlsdJWN3K+rUoT6ieNbVKwb CMJjg2glmY6UMVYdPHi/EaTOxeSj/nO1MFQnnal28bZPfe/YKAsL4eZ8kSi9KoeMBHjN FX3T2WJIDebK+h89PZ47k8uMBkD8qzmosJl/wzbEvrfPgV+kNV5GJ3cSXfEC9s5tBXMx sTmQcaecqMo3utSsSzVfF2C8R4Ve6jDKt26TdCH1gsY5HNxtzVWtDyNvBuoaqwUbeCzE gHWpacSMNKzIGOyS3vkRRuQk4+64mFVasE1Ksyo64dUIkFy6MUjHimcdCyF3x+rmOTmN YzpA== 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 w21-v6si14792727pll.96.2018.07.01.09.57.22; Sun, 01 Jul 2018 09:57:36 -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 S933933AbeGAQox (ORCPT + 99 others); Sun, 1 Jul 2018 12:44:53 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:38078 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933918AbeGAQoi (ORCPT ); Sun, 1 Jul 2018 12:44:38 -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 D620792B; Sun, 1 Jul 2018 16:44:37 +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.17 176/220] media: v4l2-compat-ioctl32: prevent go past max size Date: Sun, 1 Jul 2018 18:23:20 +0200 Message-Id: <20180701160915.589831406@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: 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 @@ -871,7 +871,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;