mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Alper Ak <alperyasinak1@gmail.com>
Cc: hverkuil@kernel.org, jonathan@marek.ca,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org, mchehab@kernel.org,
	rfoss@kernel.org, todor.too@gmail.com,
	vladimir.zapolskiy@linaro.org
Subject: Re: [PATCH v2] media: qcom: camss: vfe: Fix out-of-bounds access in vfe_isr_reg_update()
Date: Tue, 30 Dec 2025 10:04:15 +0000	[thread overview]
Message-ID: <fb14d227-ff92-4e7f-bad0-d326c729c759@linaro.org> (raw)
In-Reply-To: <20251229075217.24679-1-alperyasinak1@gmail.com>

On 29/12/2025 07:52, Alper Ak wrote:
> vfe_isr() iterates using MSM_VFE_IMAGE_MASTERS_NUM(7) as the loop
> bound and passes the index to vfe_isr_reg_update(). However,
> vfe->line[] array is defined with VFE_LINE_NUM_MAX(4):
> 
>      struct vfe_line line[VFE_LINE_NUM_MAX];
> 
> When index is 4, 5, 6, the access to vfe->line[line_id] exceeds
> the array bounds and resulting in out-of-bounds memory access.
> 
> Fix this by using separate loops for output lines and write masters.
> 
> Fixes: 4edc8eae715c ("media: camss: Add initial support for VFE hardware version Titan 480")
> Signed-off-by: Alper Ak <alperyasinak1@gmail.com>
> ---
>   drivers/media/platform/qcom/camss/camss-vfe-480.c | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/platform/qcom/camss/camss-vfe-480.c b/drivers/media/platform/qcom/camss/camss-vfe-480.c
> index 4feea590a47b..d73f733fde04 100644
> --- a/drivers/media/platform/qcom/camss/camss-vfe-480.c
> +++ b/drivers/media/platform/qcom/camss/camss-vfe-480.c
> @@ -202,11 +202,13 @@ static irqreturn_t vfe_isr(int irq, void *dev)
>   		writel_relaxed(status, vfe->base + VFE_BUS_IRQ_CLEAR(0));
>   		writel_relaxed(1, vfe->base + VFE_BUS_IRQ_CLEAR_GLOBAL);
>   
> -		/* Loop through all WMs IRQs */
> -		for (i = 0; i < MSM_VFE_IMAGE_MASTERS_NUM; i++) {
> +		for (i = 0; i < MAX_VFE_OUTPUT_LINES; i++) {
>   			if (status & BUS_IRQ_MASK_0_RDI_RUP(vfe, i))
>   				vfe_isr_reg_update(vfe, i);
> +		}
>   
> +		/* Loop through all WMs IRQs */
> +		for (i = 0; i < MSM_VFE_IMAGE_MASTERS_NUM; i++) {
>   			if (status & BUS_IRQ_MASK_0_COMP_DONE(vfe, RDI_COMP_GROUP(i)))
>   				vfe_buf_done(vfe, i);
>   		}

LGTM - assuming hardware tests pass.

Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>

---
bod

      reply	other threads:[~2025-12-30 10:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-27 10:24 [PATCH] " Alper Ak
2025-12-29  0:12 ` Bryan O'Donoghue
2025-12-29  7:52   ` [PATCH v2] " Alper Ak
2025-12-30 10:04     ` Bryan O'Donoghue [this message]

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=fb14d227-ff92-4e7f-bad0-d326c729c759@linaro.org \
    --to=bryan.odonoghue@linaro.org \
    --cc=alperyasinak1@gmail.com \
    --cc=hverkuil@kernel.org \
    --cc=jonathan@marek.ca \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=rfoss@kernel.org \
    --cc=todor.too@gmail.com \
    --cc=vladimir.zapolskiy@linaro.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®