From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E38A620F5B6; Tue, 12 Nov 2024 10:32:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731407530; cv=none; b=Mk/d7u5dStTWgEpNKwB2fMrqMlNgvl26wmhsIwU2dV6itvhxJuLO4trP/IazLWMuWwQvaUBLUNgIWjXAhc/WatJPuabfMpXWPPMEUD+H4wWygTwy3nZz3J+jrfoV4hXUIBEj+F4xET/rF5k8XgAJopgceUQnNKAWNNJiarhV+KA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731407530; c=relaxed/simple; bh=n/bgJBTjwrfEXY/9EGu3ZqtUWqHBVzcb/VJbA3Fv9iM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pDkWjGgblNgLemH6mHrJXzZXKL2GqKXrFpMQYhDEXRahOeSggCVW4B+5VwG3i4d4VslQH8N4DcDcTMHYCczfSQ3YrDpbIHG9sNd0mX5B9U8d8rXO/EPn2l3gI3+JvcJl2mAmRO29zllfMov7EOmivaM6H3mBebqWnZ2C03LkRbw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=xevHw5xx; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="xevHw5xx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C4BBC4CED4; Tue, 12 Nov 2024 10:32:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1731407529; bh=n/bgJBTjwrfEXY/9EGu3ZqtUWqHBVzcb/VJbA3Fv9iM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xevHw5xxVgFRyIIYYiyl89drkMOfPwzg33BkjPz/ukzy8dlbAV8UIOOxDDISFPN7i jfO6ekpRyhNP4SM9oWAgNoHiVUyVtZr/rgq7e8RkBJD4dVYuqVnb4SOvbgs9YSKpAA AY9zBWdYTkcN4sO/S1jX2csVT4CdgsR1b4N3Fi1Y= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Benoit Sevens , Laurent Pinchart , Hans Verkuil Subject: [PATCH 6.1 80/98] media: uvcvideo: Skip parsing frames of type UVC_VS_UNDEFINED in uvc_parse_format Date: Tue, 12 Nov 2024 11:21:35 +0100 Message-ID: <20241112101847.299357309@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241112101844.263449965@linuxfoundation.org> References: <20241112101844.263449965@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Benoit Sevens commit ecf2b43018da9579842c774b7f35dbe11b5c38dd upstream. This can lead to out of bounds writes since frames of this type were not taken into account when calculating the size of the frames buffer in uvc_parse_streaming. Fixes: c0efd232929c ("V4L/DVB (8145a): USB Video Class driver") Signed-off-by: Benoit Sevens Cc: stable@vger.kernel.org Acked-by: Greg Kroah-Hartman Reviewed-by: Laurent Pinchart Signed-off-by: Hans Verkuil Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/uvc/uvc_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -368,7 +368,7 @@ static int uvc_parse_format(struct uvc_d * Parse the frame descriptors. Only uncompressed, MJPEG and frame * based formats have frame descriptors. */ - while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE && + while (ftype && buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE && buffer[2] == ftype) { frame = &format->frame[format->nframes]; if (ftype != UVC_VS_FRAME_FRAME_BASED)