All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Anthony McGivern" <anthony.mcgivern@arm.com>,
	devicetree@vger.kernel.org
Cc: robh@kernel.org, conor+dt@kernel.org, media-ci@linuxtv.org
Subject: Re: [PATCH 18/24] media: mali-c720: Add 3A statistics video node
Date: Tue, 24 Nov 2026 17:31:07 +0000	[thread overview]
Message-ID: <sashiko-outbox-231705@kernel.org> (raw)
In-Reply-To: <20261124-b4-initial-upstream-candidate-v1-18-0cb9bde1bd30@arm.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] media: mali-c720: unlinked stats streamon leaks
  pipe.start_count on stop
--

commit acde35ee7e30f91ca98dde1602bdd7e3bb4e0204
Author: Anthony McGivern <Anthony.McGivern@arm.com>

media: mali-c720: Add 3A statistics video node

This commit adds a metadata capture video node for ISP 3A statistics and
configures the CDMA scatter-gather engine to transfer colour statistics and
pixel intensity histograms into queued buffers.

> diff --git a/drivers/media/platform/arm/mali-c720/mali-c720-stats.c b/drivers/media/platform/arm/mali-c720/mali-c720-stats.c
> new file mode 100644
> index 0000000000000..fdb31ef136c04
> --- /dev/null
> +++ b/drivers/media/platform/arm/mali-c720/mali-c720-stats.c
[ ... ]
> +static int mali_c720_stats_start_streaming(struct vb2_queue *q,
> +					   unsigned int count)
> +{
> +	struct mali_c720_stats *stats = vb2_get_drv_priv(q);
> +	struct mali_c720 *mali_c720 = stats->mali_c720;
> +	struct mali_c720_context *ctx = mali_c720_get_active_context(mali_c720);
> +	struct v4l2_subdev *isp_sd = &mali_c720->isp.mdev.sd;
> +	int ret;
> +
> +	guard(mutex) (&mali_c720->device_lock);
> +
> +	if (!media_devnode_is_registered(mali_c720->media_dev.devnode)) {
> +		ret = -ENODEV;
> +		goto err_return_buffers;
> +	}
> +
> +	ret = pm_runtime_resume_and_get(mali_c720->dev);
> +	if (ret)
> +		goto err_return_buffers;
> +
> +	ret = video_device_pipeline_start(&stats->vdev, &mali_c720->pipe);
> +	if (ret)
> +		goto err_pm_put;
> +
> +	ret = mali_c720_alloc_context(ctx);
> +	if (ret)
> +		goto err_stop_pipeline;
> +
> +	ret = mali_c720_pipeline_ready(mali_c720);
> +	if (ret && ret != -EAGAIN)
> +		goto err_free_context;
> +
> +	if (!ret) {
> +		ret = v4l2_subdev_enable_streams(isp_sd,
> +						 MALI_C720_ISP_PAD_SOURCE_HV,
> +						 BIT(0));
> +		if (ret)
> +			goto err_free_context;
> +	}
> +
> +	return 0;
[ ... ]
> +static void mali_c720_stats_stop_streaming(struct vb2_queue *q)
> +{
> +	struct mali_c720_stats *stats = vb2_get_drv_priv(q);
> +	struct mali_c720 *mali_c720 = stats->mali_c720;
> +	struct mali_c720_context *ctx = mali_c720_get_active_context(mali_c720);
> +	struct mali_c720_isp *isp = &mali_c720->isp;
> +	struct v4l2_subdev *isp_sd = &isp->mdev.sd;
> +
> +	guard(mutex) (&mali_c720->device_lock);
> +
> +	v4l2_subdev_disable_streams(isp_sd, MALI_C720_ISP_PAD_SOURCE_HV,
> +				    BIT(0));
> +	mali_c720_stats_return_buffers(stats, VB2_BUF_STATE_ERROR);
> +
> +	mali_c720_free_context(ctx);
> +
> +	video_device_pipeline_stop(&stats->vdev);

[Severity: High]
Can starting and stopping streaming on the 3A stats node while its media
link is disabled leak mali_c720->pipe.start_count and stop an active
capture stream?

mali_c720_create_3a_links() creates the link to stats.vdev disabled by
default.  When a linked capture node (such as fr0-rgb) is already
streaming, mali_c720->pipe.start_count is non-zero and stats->pad.pipe is
NULL.  If userspace then calls VIDIOC_STREAMON on the unlinked stats node,
__media_pipeline_start() takes its start_count > 0 early return without
checking MEDIA_PAD_FL_MUST_CONNECT or setting stats->pad.pipe, and
mali_c720_stats_start_streaming() ignores the resulting -EAGAIN from
mali_c720_pipeline_ready().

When the stats node later stops streaming, mali_c720_stats_stop_streaming()
disables the active ISP stream for the still-running capture node and calls
video_device_pipeline_stop(&stats->vdev) with stats->pad.pipe == NULL,
which triggers WARN_ON(!pipe) in __media_pipeline_stop() and returns
without decrementing mali_c720->pipe.start_count.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261124-b4-initial-upstream-candidate-v1-0-0cb9bde1bd30@arm.com?part=18

  reply	other threads:[~2026-11-24 17:31 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24 17:07 [PATCH 00/24] Add Arm Mali-C720 Image Signal Processor Driver Anthony McGivern
2026-11-24 17:07 ` [PATCH 01/24] media: uapi: Add 24-bit Bayer media bus formats Anthony McGivern
2026-11-24 17:07 ` [PATCH 02/24] dt-bindings: media: Add bindings for Arm Mali-C720 Anthony McGivern
2026-11-24 17:18   ` sashiko-bot
2026-11-25  8:51   ` Krzysztof Kozlowski
2026-11-26 14:55     ` Anthony McGivern
2026-11-26 15:12       ` Krzysztof Kozlowski
2026-11-27 12:32         ` Anthony McGivern
2026-11-27 12:49           ` Laurent Pinchart
2026-11-27 14:25             ` Anthony McGivern
2026-11-24 17:07 ` [PATCH 03/24] media: uapi: Add a control ID base for Mali-C720 ISP Anthony McGivern
2026-11-24 17:07 ` [PATCH 04/24] media: mali-c720: Add register access helpers Anthony McGivern
2026-11-24 17:07 ` [PATCH 05/24] media: mali-c720: Add hardware identification Anthony McGivern
2026-11-25  8:52   ` Krzysztof Kozlowski
2026-11-26 15:00     ` Anthony McGivern
2026-11-24 17:07 ` [PATCH 06/24] media: mali-c720: Add format handling Anthony McGivern
2026-11-24 17:07 ` [PATCH 07/24] media: mali-c720: Add hardware discovery support Anthony McGivern
2026-11-24 17:07 ` [PATCH 08/24] media: mali-c720: Add context manager and interrupt handling Anthony McGivern
2026-11-24 17:07 ` [PATCH 09/24] media: mali-c720: Add input frontend subdevice Anthony McGivern
2026-11-24 17:07 ` [PATCH 10/24] media: mali-c720: Add ISP and human vision subdevices Anthony McGivern
2026-11-24 17:07 ` [PATCH 11/24] media: mali-c720: Add full-resolution output subdevice Anthony McGivern
2026-11-24 17:21   ` sashiko-bot
2026-11-24 17:07 ` [PATCH 12/24] media: mali-c720: Add video capture nodes Anthony McGivern
2026-11-24 17:35   ` sashiko-bot
2026-11-24 17:07 ` [PATCH 13/24] media: mali-c720: Add Mali-C720 ISP driver Anthony McGivern
2026-11-25  8:55   ` Krzysztof Kozlowski
2026-11-26 15:53     ` Anthony McGivern
2026-12-01 18:40       ` Linus Walleij
2026-12-01 22:10         ` Laurent Pinchart
2026-12-01 22:20           ` Linus Walleij
2026-11-24 17:07 ` [PATCH 14/24] media: mali-c720: Add test pattern generator subdevices Anthony McGivern
2026-11-24 17:07 ` [PATCH 15/24] media: Documentation: Add Mali-C720 ISP documentation Anthony McGivern
2026-11-24 17:20   ` sashiko-bot
2026-11-28  0:43   ` kernel test robot
2026-11-24 17:07 ` [PATCH 16/24] media: uapi: Add Mali-C720 statistics meta format Anthony McGivern
2026-11-24 17:07 ` [PATCH 17/24] media: uapi: Add statistics structs to mali-c720-config.h Anthony McGivern
2026-11-24 17:26   ` sashiko-bot
2026-11-24 17:07 ` [PATCH 18/24] media: mali-c720: Add 3A statistics video node Anthony McGivern
2026-11-24 17:31   ` sashiko-bot [this message]
2026-11-24 17:07 ` [PATCH 19/24] media: Documentation: Document Mali-C720 statistics capture Anthony McGivern
2026-11-24 17:25   ` sashiko-bot
2026-11-24 17:07 ` [PATCH 20/24] media: uapi: Add Mali-C720 parameters meta format Anthony McGivern
2026-11-24 17:07 ` [PATCH 21/24] media: uapi: Add parameter structs to mali-c720-config.h Anthony McGivern
2026-11-24 17:33   ` sashiko-bot
2026-11-24 17:07 ` [PATCH 22/24] media: mali-c720: Add parameters video node Anthony McGivern
2026-11-24 17:45   ` sashiko-bot
2026-11-24 17:07 ` [PATCH 23/24] media: Documentation: Document Mali-C720 parameter settings Anthony McGivern
2026-11-24 17:07 ` [PATCH 24/24] MAINTAINERS: Add entry for mali-c720 driver Anthony McGivern

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=sashiko-outbox-231705@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=anthony.mcgivern@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=media-ci@linuxtv.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.