Skip to content

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

Closed
Sebasteuo wants to merge 1 commit intoraspberrypi:rpi-6.12.yfrom
Sebasteuo:fix/mmal-vchiq-component-index-6.18
Closed

staging: vc04_services: vchiq-mmal: validate component index in event_to_host_cb()#7325
Sebasteuo wants to merge 1 commit intoraspberrypi:rpi-6.12.yfrom
Sebasteuo:fix/mmal-vchiq-component-index-6.18

Conversation

@Sebasteuo
Copy link
Copy Markdown

This is a rebase of PR #7296 containing only the first commit,
as requested by @popcornmix.

The remaining three patches (inline_receive buffer check,
port_parameter_set stack overflow, port_parameter_get underflow)
apply to upstream code and will be submitted to the mainline
kernel via the staging mailing list separately.

…_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

Should this have been submitted against rpi-6.18.y?

@Sebasteuo
Copy link
Copy Markdown
Author

rpi-6.18.y wasn't available in the branch list when I opened this, happy to retarget if you can point me to it.

@popcornmix
Copy link
Copy Markdown
Collaborator

rpi-6.18.y is the list of branches. Right here.
We'll switch apt to 6.18 kernel in the next couple of weeks.

@Sebasteuo Sebasteuo closed this Apr 21, 2026
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.

2 participants