Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3979808pxb; Tue, 25 Jan 2022 00:32:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJxn9/COQ+lO0jlMkiFC7QEJR6xMHCxvuhAGGLAgfQMTTdXumj6mfwZfjWp30LJJcr2O2OZt X-Received: by 2002:a17:90a:4dc9:: with SMTP id r9mr2361326pjl.156.1643099558605; Tue, 25 Jan 2022 00:32:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643099558; cv=none; d=google.com; s=arc-20160816; b=KrMCh/aVdd2nwK4eNu88KUjSCvp0eQ4nALMGZYbRUoSnlL4NjbJE4y/CEWyZY05Go2 LWdqd3Whd/CkjMy61KZ9ODn3p5jp+G5ZmofbXkJNraItC609esZTg3niNW8+W4TsE3L8 stZI2+cOWTZGdYRBVoRFyQx4xCzFlKeckNZtdNhXM4sG31jrj+2j0BPurEllhnF03IG3 e6Nrh3UDsJg+Q00NC7TZDehyk3UVDUBRElLYFLU/ar+zRu9o1DNkWVdc5F8IrJkbdZi5 xfnleb6WRSTZ0Ciy+t0Z8mtFIv4fzLwNV1KtUqKjScm1zPaLmNqw0ax44L+7+Edo5WkB KR+w== 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=rRteIRWT2aKkp0n6XliaIwcZay9UE/9d61X2Dpp/B2g=; b=gtq+DHtb9PaxRZMezyJy8c4umulFe6f0n1OJMOwzolVLTJlx8o1pWIGLrIJ6M+QEim AuF18FO2oMIBX3NvAlIGCMkE1EdPlXTp0dzOG2Bi4k0DpiK01SLW+C8wuaDHqDURQTyX Q9COVZuTXNAj+k6KK0T5vG9wIOSZPoDIN74ltei6TWpWEvSBSXSzlzjqdv1B36l2a2pI B566/0J1JvCxr1+L3vn8pv3Ampj3eeKvuxAbwxkW5LOAWjBh30T3vIENsDWRAxPJv+cn mL/dAIWarvW5wocbBTY6ycm5IrxxtEyaI1wXVGodQwG06HlEJwjeFHOGsfO40G3yj7cX Lg3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ji5ocejV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l20si18327459pfc.91.2022.01.25.00.32.27; Tue, 25 Jan 2022 00:32:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Ji5ocejV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1314518AbiAYCvL (ORCPT + 99 others); Mon, 24 Jan 2022 21:51:11 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:57696 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1445899AbiAXVFJ (ORCPT ); Mon, 24 Jan 2022 16:05:09 -0500 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 ams.source.kernel.org (Postfix) with ESMTPS id A0356B8122A; Mon, 24 Jan 2022 21:05:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7DF8C340E5; Mon, 24 Jan 2022 21:05:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058306; bh=VPdI+TVD86eHiCgBauoaGl9SJlHqgi95GTzmkIVc46U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ji5ocejVTWbk28PUsfCJG3Qh58gU8F47onLnUJw5VkViF8aT1en6URwydPEFtwASu 2XqoG2FZ4IluDfnFN6nrZf537j+f5ItwG7BXBlFN65j4G7gd6NY7VcAZaRJAW4r+r7 mdQcCKnCsBly7fQc4l6zG/vqmikFSkzk47Zx/3+k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ricardo Ribalda , Laurent Pinchart , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.16 0246/1039] media: uvcvideo: Avoid returning invalid controls Date: Mon, 24 Jan 2022 19:33:55 +0100 Message-Id: <20220124184133.593956076@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ricardo Ribalda [ Upstream commit 414d3b49d9fd4a0bb16a13d929027847fd094f3f ] If the memory where ctrl_found is placed has the value of uvc_ctrl and __uvc_find_control does not find the control we will return an invalid index. Fixes: 6350d6a4ed487 ("media: uvcvideo: Set error_idx during ctrl_commit errors") Signed-off-by: Ricardo Ribalda Signed-off-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/usb/uvc/uvc_ctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index 9a25d60292558..b4f6edf968bc0 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -1639,7 +1639,7 @@ static int uvc_ctrl_find_ctrl_idx(struct uvc_entity *entity, struct uvc_control *uvc_control) { struct uvc_control_mapping *mapping = NULL; - struct uvc_control *ctrl_found; + struct uvc_control *ctrl_found = NULL; unsigned int i; if (!entity) -- 2.34.1