Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2491666rwb; Mon, 3 Oct 2022 01:13:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Z1GCqEdlR4yJ5wfE2ynju7DUH75k1WWXRu+qkNRIq/oIsjcIL9ZM0Er1z0VSv636HYgq+ X-Received: by 2002:a63:20f:0:b0:439:c92f:e6d1 with SMTP id 15-20020a63020f000000b00439c92fe6d1mr17653109pgc.334.1664784807187; Mon, 03 Oct 2022 01:13:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664784807; cv=none; d=google.com; s=arc-20160816; b=rVWMj3IjGMGtnAxaq1XRPcY1fCNN8tW0Ma/IEWLk/bQQ8fbN7sizXnNSTD1fqgcQv3 LgDn1t3EoRtBx+Get8RUVCdDTRmQMuH6zFBvBs2nGnROu+7TT0q4wocyKtpuvW7vlGQD PF+s3fUjr29CX/diyBlcr7qDa5Vf234f5X1MyiVdilD3HlTII8qy0zj/mimb3ulVqlol bYwDHVbBnMEtJE1e0nncBA4790N3Gv+q7/oUPrHkcT2mQPAG01vtmbF82vYBHE4NPZ2y f5XVsYianZoc8CQl8NaAbJY2ijVZpYIcG6LL814wSdyDd0xx4BnRv8upDNbS48/NdAa7 wgmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Kebo+M+ykDYT7jiMYl0PirQu77IEdHXW0g7nOFRk5gE=; b=smjqjf2cGN40j0mm9f8xErbvbUSAVtCZzfxqPoFwzUUqNdpGO5Bpt4nGWqirCG44XX kh4pxDJnbclKci8tGdTSvBqvI323OH5APKzSQiYGINaMzudz6XXGVOKpQXm1RBMUPp+R d4Y+7NKcXuytzhltMDWKYDdWPe8voHUOuGc0vZRBeze32xSp1bnAqggXVfiwxm21UAma b9fsVTCTuklt85PC3XOGkfuC0HaZChneUzPPlHhY5c9yBVIfBXyy0jlyDSEBO4S1uxbH oJlaws/PHGp6UNpTYP2JyxjvRDLXOOyC3hkKKFzffrZBDYEWjC2cC2iw1OvSv3zIHRCp jnsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nvKew4cJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k11-20020a62840b000000b00560ad1951e7si4332604pfd.356.2022.10.03.01.13.16; Mon, 03 Oct 2022 01:13:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nvKew4cJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231575AbiJCHfg (ORCPT + 99 others); Mon, 3 Oct 2022 03:35:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231778AbiJCHe2 (ORCPT ); Mon, 3 Oct 2022 03:34:28 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4EAC52DFC; Mon, 3 Oct 2022 00:22:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id E07C1CE0B19; Mon, 3 Oct 2022 07:18:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2581C433C1; Mon, 3 Oct 2022 07:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781483; bh=V38LlX0q8zKlpeuuZ8af615SwKazMoTeMAv5NP354dE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nvKew4cJ+tK3rkbqstBDJNsdc2a4jAsqPPIuFYBCqoRIEOn/bbTBbbN8bsg4wYR8C AOauNAb6SvBKDa5OA2knGzSJA5dJ2ebMZ/FmhrJvOufd6j85mxeNjgtkD/3kVXs0TD y5inYD4JQprBHxtc69ayzb5q1+riX3l/RP0ovRe8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , syzbot+ff18193ff05f3f87f226@syzkaller.appspotmail.com, Laurent Pinchart , Mauro Carvalho Chehab Subject: [PATCH 5.15 37/83] media: v4l2-compat-ioctl32.c: zero buffer passed to v4l2_compat_get_array_args() Date: Mon, 3 Oct 2022 09:11:02 +0200 Message-Id: <20221003070722.926248909@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070721.971297651@linuxfoundation.org> References: <20221003070721.971297651@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hans Verkuil commit 4e768c8e34e639cff66a0f175bc4aebf472e4305 upstream. The v4l2_compat_get_array_args() function can leave uninitialized memory in the buffer it is passed. So zero it before copying array elements from userspace into the buffer. Signed-off-by: Hans Verkuil Reported-by: syzbot+ff18193ff05f3f87f226@syzkaller.appspotmail.com Reviewed-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c +++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c @@ -1033,6 +1033,8 @@ int v4l2_compat_get_array_args(struct fi { int err = 0; + memset(mbuf, 0, array_size); + switch (cmd) { case VIDIOC_G_FMT32: case VIDIOC_S_FMT32: