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 864AD2E22A6; Mon, 18 Aug 2025 13:12:52 +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=1755522772; cv=none; b=BvcTmPOxzhZLEBDtW3TYcBGnu5GVXio3RJgZICygGdYRcKRCOoTzPTH0JJTTfmP2C7qDS8wYdx1PQwc2Zx0Dp3psE9ScVN9RWqcJAiqdAWG7tuQ0lhXpwQrewQzyolaQ5HOwXZQfis6spNdPUwYoT1UaHhrLOIbVedIF5paB7IA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755522772; c=relaxed/simple; bh=zUCuWW7y+4//8LsCCTweeJTmUPt8oFQoMDSdffSif0A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IfhEWuz1IIbYyDN6EFC7PWbDT+OUKdZ7MdtvespSg4rK1Smbd9Fs+Oz6R9BFGzAiCyWPC61A0s4bo1BXIBalY1u7H4nhZBcNZHYcJHM8bx8uPN2t1PMRaKE3nQ6hzdGbs1r/f0UYse3XAOhHWtXdg4llZ4et6cOdSduSSlPAYKg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=R7bXRRQ+; 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="R7bXRRQ+" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8AF4C113D0; Mon, 18 Aug 2025 13:12:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1755522772; bh=zUCuWW7y+4//8LsCCTweeJTmUPt8oFQoMDSdffSif0A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R7bXRRQ+gDhbUZrAT83gN7NIEuciRNZ+sPH2KaGgFgkID8fnzLiIRXXF16SVtmTio Buz96cVzwbAygj+WdcQxUJkDgXtyTLtguFLo6ih2QMvdPkPP1Kap6f0MHaJ8NMiSoY l7dVy0qW5DKl+qOX1F2Tee4efEGSpRzWuJ/n3dMk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Youngjun Lee , Laurent Pinchart , Ricardo Ribalda , Hans Verkuil Subject: [PATCH 6.12 416/444] media: uvcvideo: Fix 1-byte out-of-bounds read in uvc_parse_format() Date: Mon, 18 Aug 2025 14:47:22 +0200 Message-ID: <20250818124504.531375699@linuxfoundation.org> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250818124448.879659024@linuxfoundation.org> References: <20250818124448.879659024@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Youngjun Lee commit 782b6a718651eda3478b1824b37a8b3185d2740c upstream. The buffer length check before calling uvc_parse_format() only ensured that the buffer has at least 3 bytes (buflen > 2), buf the function accesses buffer[3], requiring at least 4 bytes. This can lead to an out-of-bounds read if the buffer has exactly 3 bytes. Fix it by checking that the buffer has at least 4 bytes in uvc_parse_format(). Signed-off-by: Youngjun Lee Reviewed-by: Laurent Pinchart Fixes: c0efd232929c ("V4L/DVB (8145a): USB Video Class driver") Cc: stable@vger.kernel.org Reviewed-by: Ricardo Ribalda Link: https://lore.kernel.org/r/20250610124107.37360-1-yjjuny.lee@samsung.com Signed-off-by: Laurent Pinchart Signed-off-by: Hans Verkuil Signed-off-by: Greg Kroah-Hartman --- drivers/media/usb/uvc/uvc_driver.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -235,6 +235,9 @@ static int uvc_parse_format(struct uvc_d unsigned int i, n; u8 ftype; + if (buflen < 4) + return -EINVAL; + format->type = buffer[2]; format->index = buffer[3]; format->frames = frames;