mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
To: David Carlier <devnexen@gmail.com>
Cc: linux-media@vger.kernel.org, dan.scally@ideasonboard.com,
	 jacopo.mondi@ideasonboard.com, mchehab@kernel.org,
	nayden.kanchev@arm.com,  hverkuil+cisco@kernel.org,
	stable@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] media: mali-c55: Check the parameters buffer address before copying
Date: Wed, 30 Sep 2026 17:28:36 +0200	[thread overview]
Message-ID: <ar0pyfRIZDOtZp23@zed> (raw)
In-Reply-To: <20260906092429.50046-1-devnexen@gmail.com>

Hi David

On Sun, Sep 06, 2026 at 10:24:24AM +0100, David Carlier wrote:
> mali_c55_params_buf_prepare() copies the parameters buffer supplied by
> userspace into the driver's scratch buffer, using the result of
> vb2_plane_vaddr() as the source without checking it. The queue accepts
> VB2_DMABUF, and vb2_dc_vaddr() returns NULL for an exporter that cannot
> be vmapped, so the memcpy() dereferences NULL.
>
> Reject the buffer at prepare time instead.
>
> Fixes: d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")
> Cc: stable@vger.kernel.org
> Signed-off-by: David Carlier <devnexen@gmail.com>

Quite a corner case I would say, but it's anyway good to check.

Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>

> ---
>  drivers/media/platform/arm/mali-c55/mali-c55-params.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-params.c b/drivers/media/platform/arm/mali-c55/mali-c55-params.c
> index 70106276b7e4..16e895e3488e 100644
> --- a/drivers/media/platform/arm/mali-c55/mali-c55-params.c
> +++ b/drivers/media/platform/arm/mali-c55/mali-c55-params.c
> @@ -710,6 +710,9 @@ static int mali_c55_params_buf_prepare(struct vb2_buffer *vb)
>  	struct mali_c55 *mali_c55 = params->mali_c55;
>  	int ret;
>
> +	if (!config)
> +		return -EFAULT;
> +
>  	ret = v4l2_isp_params_validate_buffer_size(mali_c55->dev, vb,
>  			v4l2_isp_buffer_size(MALI_C55_PARAMS_MAX_SIZE));
>  	if (ret)
> --
> 2.55.0
>
>

      parent reply	other threads:[~2026-09-30 15:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-06  9:24 David Carlier
2026-09-06  9:24 ` [PATCH 2/2] media: mali-c55: Check the statistics buffer address before filling David Carlier
2026-09-30 15:29   ` Jacopo Mondi
2026-09-30 15:28 ` Jacopo Mondi [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=ar0pyfRIZDOtZp23@zed \
    --to=jacopo.mondi@ideasonboard.com \
    --cc=dan.scally@ideasonboard.com \
    --cc=devnexen@gmail.com \
    --cc=hverkuil+cisco@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nayden.kanchev@arm.com \
    --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®