Skip to content

staging: vc04_services: vchiq-mmal: validate component index in event_to_host_cb()#7327

Merged
pelwell merged 1 commit intoraspberrypi:rpi-6.18.yfrom
Sebasteuo:fix/mmal-vchiq-v3
Apr 21, 2026
Merged

staging: vc04_services: vchiq-mmal: validate component index in event_to_host_cb()#7327
pelwell merged 1 commit intoraspberrypi:rpi-6.18.yfrom
Sebasteuo:fix/mmal-vchiq-v3

Conversation

@Sebasteuo
Copy link
Copy Markdown

Rebased correctly onto rpi-6.18.y. Replaces #7326.

event_to_host_cb() uses msg->u.event_to_host.client_component as an
index into instance->component[] (size VCHIQ_MMAL_MAX_COMPONENTS = 64)
without bounds validation. Add a bounds check to harden against
potential firmware bugs.

…_to_host_cb()

event_to_host_cb() uses msg->u.event_to_host.client_component as an
index into the instance->component[] array (size VCHIQ_MMAL_MAX_COMPONENTS
= 64) without bounds validation. While the kernel generally trusts the
hardware it is bound to, a bounds check here hardens the driver against
potential firmware bugs that could otherwise cause an uncontrolled
out-of-bounds array access and kernel crash.

Add a bounds check on comp_idx before using it as an array index and
move the component pointer assignment after the validation. Use
pr_err_ratelimited() to avoid log flooding. Note: this file does not
currently have access to a struct device, so dev_err() is not available.

Cc: stable@vger.kernel.org
Fixes: b18ee53 ("staging: bcm2835: Break MMAL support out from camera")
Signed-off-by: Sebastián Alba Vives <sebasjosue84@gmail.com>
@popcornmix
Copy link
Copy Markdown
Collaborator

Okay by me. @6by9 ?

@6by9
Copy link
Copy Markdown
Contributor

6by9 commented Apr 21, 2026

Looks good to me too.

@pelwell pelwell merged commit 311a064 into raspberrypi:rpi-6.18.y Apr 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants