Linux kernel staging patches
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Pavan Kumar Yalagada <pavankumaryalagada@gmail.com>
Cc: parthiban.veerasooran@microchip.com,
	christian.gromm@microchip.com, dan.carpenter@linaro.org,
	laurent.pinchart+renesas@ideasonboard.com,
	hverkuil+cisco@kernel.org, linux-staging@lists.linux.dev
Subject: Re: [PATCH v2] staging: most: video: prevent probes during component exit
Date: Wed, 26 Nov 2025 18:24:33 +0100	[thread overview]
Message-ID: <2025112647-satchel-enjoying-f403@gregkh> (raw)
In-Reply-To: <20251126155910.32694-1-pavankumaryalagada@gmail.com>

On Wed, Nov 26, 2025 at 10:59:10AM -0500, Pavan Kumar Yalagada wrote:
> Previously, comp_probe_channel() would always add a new device to
> video_devices, even if comp_exit() was running. This caused
> BUG_ON(!list_empty(&video_devices)) in comp_exit() because
> the list could be repopulated during teardown.
> 
> This patch adds a global static flag `comp_exiting`:
> 
> - Set `comp_exiting = true` at the start of comp_exit()
>   to signal shutdown.
> - Check `comp_exiting` at the start of comp_probe_channel()
>   and return -EBUSY if set.
> 
> This prevents new devices from being added while the component
> is exiting, ensuring video_devices stays empty and avoiding
> BUG_ON triggers.
> 
> Signed-off-by: Pavan Kumar Yalagada <pavankumaryalagada@gmail.com>
> ---
>  drivers/staging/most/video/video.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/most/video/video.c b/drivers/staging/most/video/video.c
> index 32f71d9a9cf7..96366b7a0e29 100644
> --- a/drivers/staging/most/video/video.c
> +++ b/drivers/staging/most/video/video.c
> @@ -60,6 +60,8 @@ static inline struct comp_fh *to_comp_fh(struct file *filp)
>  static LIST_HEAD(video_devices);
>  static DEFINE_SPINLOCK(list_lock);
>  
> +static bool comp_exiting;
> +
>  static inline bool data_ready(struct most_video_dev *mdev)
>  {
>  	return !list_empty(&mdev->pending_mbos);
> @@ -453,6 +455,9 @@ static int comp_probe_channel(struct most_interface *iface, int channel_idx,
>  			      struct most_channel_config *ccfg, char *name,
>  			      char *args)
>  {
> +	if (comp_exiting)
> +		return -EBUSY;

This will not work at all.

Also, you need to properly document a v2 patch.

thanks,

greg k-h

  reply	other threads:[~2025-11-26 17:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-26 15:59 [PATCH v2] staging: most: video: prevent probes during component exit Pavan Kumar Yalagada
2025-11-26 17:24 ` Greg KH [this message]
2025-11-26 17:48 ` Dan Carpenter

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=2025112647-satchel-enjoying-f403@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=christian.gromm@microchip.com \
    --cc=dan.carpenter@linaro.org \
    --cc=hverkuil+cisco@kernel.org \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --cc=linux-staging@lists.linux.dev \
    --cc=parthiban.veerasooran@microchip.com \
    --cc=pavankumaryalagada@gmail.com \
    /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