From: Hyeonjun Hong <hyeonjunhong330@gmail.com>
To: "Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>
Cc: Geert Uytterhoeven <geert+renesas@glider.be>,
Magnus Damm <magnus.damm@gmail.com>,
linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: [PATCH 0/2] media: rcar-isp: Fix ConfigDMA buffer overflow
Date: Thu, 3 Dec 2026 00:17:16 +0900 [thread overview]
Message-ID: <20261202151718.694973-1-hyeonjunhong330@gmail.com> (raw)
Hi,
The bounds check that protects the ConfigDMA buffer of the R-Car ISP
core does not account for the 8 byte header, so one address/value pair
can be written past the end of the 16384 byte buffer. The number of
pairs depends on the parameters buffer queued by userspace on the
params video node.
Patch 1/2 fixes the check. Patch 2/2 makes buffer preparation fail when
the buffer is full, as the result of the write callback is not checked
by the rppx1 block handlers.
How this was found and tested:
- Found by reading the callers of the v4l2-isp helpers side by side,
with the help of an LLM (Claude).
- I do not have R-Car hardware. The overflow was reproduced only in a
userspace model that compiles the unmodified function bodies of
risp_conf_dma_prepare(), rppx1_params(), the CCOR block handler and
the v4l2-isp validation helpers, built with AddressSanitizer.
170 header-only, disabled CCOR_POST blocks: 2041 pairs, no report.
171 blocks: heap-buffer-overflow, WRITE of size 4, 0 bytes after the
16384 byte region, in risp_conf_dma_prepare().
With the series applied: stops at 2047 pairs (16384 bytes used) and
returns -ENOMEM.
- Compile tested for arm64 with W=1.
- Not tested on hardware.
One thing I could not resolve from the code: risp_core_job_prepare() in
core.c limits the pair count to (RISP_IO_PARAMS_BUF_SIZE - 8) / 16,
i.e. 16 bytes per pair, while core-io.c and vsp1_vspx.c count 8 bytes
per pair. With this series a buffer holding 1024..2047 pairs passes
buf_prepare and is then rejected when the job is prepared. I left that
check alone as I do not know which limit is the intended one.
Hyeonjun Hong (2):
media: rcar-isp: Account for the header in the ConfigDMA bounds check
media: rcar-isp: Fail buffer preparation if the ConfigDMA buffer is
full
drivers/media/platform/renesas/rcar-isp/core-io.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
base-commit: 62dfd7c0e599b6f02392b117ee77a070796ad765
--
2.34.1
next reply other threads:[~2026-12-02 15:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 15:17 Hyeonjun Hong [this message]
2026-12-02 15:17 ` [PATCH 1/2] media: rcar-isp: Account for the header in the ConfigDMA bounds check Hyeonjun Hong
2026-12-02 15:17 ` [PATCH 2/2] media: rcar-isp: Fail buffer preparation if the ConfigDMA buffer is full Hyeonjun Hong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261202151718.694973-1-hyeonjunhong330@gmail.com \
--to=hyeonjunhong330@gmail.com \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mchehab@kernel.org \
--cc=niklas.soderlund@ragnatech.se \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®