From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 335483382CB; Sat, 12 Sep 2026 19:41:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789242091; cv=none; b=ZIxjx6+nxHhmsGlIUQfjiXjGANie1dvOLrlN65754Nx4efOHjIZoP8QHSj7PNITr6H+A4JnADHGr+NkYmf/bXqY5TQaFUrFxBTvGGtZr2eCrtlWDqREA3/SRrfR9L9Zw4qZwqK9k7G7LOCcCAav6DuqOHctVzYSK5wKmqdSKs9Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789242091; c=relaxed/simple; bh=pRk/+kZuOXav8+TPUu/owalUBYBUd5XQTLF4n1KtevU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZllbTANAwZqIHRa5sgPKxkU8lFHki/cohYr+krPt4P71lY4WKEr23Ff9ItoTpADZGDWIYOEzQjX61xVTPsFIOFBVEYxyMxyY/6vDsJcLlmTjwFH17qDkH7ViaBT22hKpMCduZKssG/OupZAyizhZVNQcr9BNUu7opMgnBZBNFD8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ksThRk8I; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ksThRk8I" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 619AC1F000FF; Sat, 12 Sep 2026 19:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789242089; bh=QRIzCY5FesJfpAKqKY50aAtY1h37cHZZWXbyMbE/EDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ksThRk8Im5J4zQ6qpWJvROEiCty7ZHwD9CJBW7wZNTKbxYWPNIYBaolhY5NAdR6yX 2Kbzq8S2QFVhslYVb07e/gBHh3UwwSxLYlJvS9W2Kr5AlXkQ3a/9qKxGrOsNRIIEMO CdMyl5nqD6VaexuhiTE13QPUhaIpEHPu/Wh3ZP0E= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Christian Hewitt , Nicolas Dufresne , Hans Verkuil Subject: [PATCH 5.10 280/798] media: meson: vdec: fix NULL pointer deref in vdec_try_fmt_common Date: Sat, 12 Sep 2026 08:58:28 +0200 Message-ID: <20260912065523.576715511@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065516.948645775@linuxfoundation.org> References: <20260912065516.948645775@linuxfoundation.org> User-Agent: quilt/0.69 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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Christian Hewitt commit 20aa934ace6917262ff579a73ec018d06a7bad1c upstream. When VIDIOC_TRY_FMT is called with an unsupported pixel format on the OUTPUT queue, vdec_try_fmt_common() falls back to V4L2_PIX_FMT_MPEG2. However, if a distro has locally patched MPEG2 support out (as it has been broken for some time) the platform format table does not contain MPEG2 so find_format() returns NULL and the subsequent dereference of fmt_out->max_width triggers a NULL pointer dereference. Fix this by falling back to the first format in the platform's format array instead of hardcoding V4L2_PIX_FMT_MPEG2. This is always valid since every platform defines at least one format. Fixes: 3e7f51bd9607 ("media: meson: add v4l2 m2m video decoder driver") Cc: stable@vger.kernel.org Signed-off-by: Christian Hewitt Reviewed-by: Nicolas Dufresne Signed-off-by: Nicolas Dufresne Signed-off-by: Hans Verkuil Signed-off-by: Greg Kroah-Hartman --- drivers/staging/media/meson/vdec/vdec.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/staging/media/meson/vdec/vdec.c +++ b/drivers/staging/media/meson/vdec/vdec.c @@ -505,8 +505,8 @@ vdec_try_fmt_common(struct amvdec_sessio case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: fmt_out = find_format(fmts, size, pixmp->pixelformat); if (!fmt_out) { - pixmp->pixelformat = V4L2_PIX_FMT_MPEG2; - fmt_out = find_format(fmts, size, pixmp->pixelformat); + pixmp->pixelformat = fmts[0].pixfmt; + fmt_out = &fmts[0]; } break; case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: