* [PATCH] media: pispbe: check configuration buffer CPU mappings
@ 2026-09-13 12:52 Slavin Liu
2026-11-27 2:27 ` Roy
0 siblings, 1 reply; 2+ messages in thread
From: Slavin Liu @ 2026-09-13 12:52 UTC (permalink / raw)
To: jacopo.mondi, mchehab, florian.fainelli
Cc: kernel-list, bcm-kernel-feedback-list, linux-media,
linux-rpi-kernel, linux-arm-kernel, linux-kernel, bolin.liu
vb2_plane_vaddr() can return NULL when a DMA-BUF exporter cannot
provide a CPU mapping, even when the buffer's DMA mapping succeeded.
pispbe_node_buffer_prepare() unconditionally copies the configuration
from that address.
Reject the buffer with -ENOMEM before copying or validating the
configuration if no CPU mapping is available. No buffer is queued or
hardware operation started on this failure path.
Detected by static analysis and reviewed with AI-assisted source auditing.
Fixes: 12187bd5d4f8 ("media: raspberrypi: Add support for PiSP BE")
Assisted-by: LLM
Signed-off-by: Slavin Liu <bolin.liu@seu.edu.cn>
---
drivers/media/platform/raspberrypi/pisp_be/pisp_be.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
index d60d92d2ffa1..56bcf69d70f8 100644
--- a/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
+++ b/drivers/media/platform/raspberrypi/pisp_be/pisp_be.c
@@ -839,6 +839,9 @@ static int pispbe_node_buffer_prepare(struct vb2_buffer *vb)
void *dst = &node->pispbe->config[vb->index];
void *src = vb2_plane_vaddr(vb, 0);
+ if (!src)
+ return -ENOMEM;
+
memcpy(dst, src, sizeof(struct pisp_be_tiles_config));
return pisp_be_validate_config(pispbe, dst);
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] media: pispbe: check configuration buffer CPU mappings
2026-09-13 12:52 [PATCH] media: pispbe: check configuration buffer CPU mappings Slavin Liu
@ 2026-11-27 2:27 ` Roy
0 siblings, 0 replies; 2+ messages in thread
From: Roy @ 2026-11-27 2:27 UTC (permalink / raw)
To: Slavin Liu
Cc: jacopo.mondi, mchehab, florian.fainelli, kernel-list,
bcm-kernel-feedback-list, linux-media, linux-rpi-kernel,
linux-arm-kernel, linux-kernel
On Sun, 13 Sep 2026 20:52:24 +0800, Slavin Liu wrote:
> Reject the buffer with -ENOMEM before copying or validating the
> configuration if no CPU mapping is available.
I tested this on a Raspberry Pi 5 (Raspberry Pi OS kernel 6.18.39),
together with the other two pending pisp_be fixes, by rebuilding the
pisp_be module.
Queueing MMAP buffers on the config node still goes through the copy
and pisp_be_validate_config() as before (an all-zero config is rejected
with -EIO, same as without the patch), and v4l2-compliance -m on the
pispbe media device passes 400/400. I couldn't make vb2_plane_vaddr()
return NULL here, so the new check itself isn't exercised.
Tested-by: Roy <rongh7426@gmail.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-27 2:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-13 12:52 [PATCH] media: pispbe: check configuration buffer CPU mappings Slavin Liu
2026-11-27 2:27 ` Roy
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®