All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Pavan Kumar Yalagada <pavankumaryalagada@gmail.com>
Cc: parthiban.veerasooran@microchip.com,
	christian.gromm@microchip.com, gregkh@linuxfoundation.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 20:48:30 +0300	[thread overview]
Message-ID: <aSc9bvj9is1c-FUB@stanley.mountain> (raw)
In-Reply-To: <20251126155910.32694-1-pavankumaryalagada@gmail.com>

On Wed, Nov 26, 2025 at 10:59:10AM -0500, Pavan Kumar Yalagada wrote:
> @@ -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;
> +
>  	int ret;
>  	struct most_video_dev *mdev = get_comp_dev(iface, channel_idx);

You've added this check above the declaration block which is ugly.

But what would happen if comp_exiting is false when we check here but
it's true by the time we get to the line which says:

	list_add(&mdev->list, &video_devices);

There would still be a race.

>  
> @@ -553,6 +558,7 @@ static int __init comp_init(void)
>  
>  static void __exit comp_exit(void)
>  {
> +	comp_exiting = true;
>  	struct most_video_dev *mdev, *tmp;

In front of the declaration block.

>  
>  	/*
> @@ -575,7 +581,7 @@ static void __exit comp_exit(void)
>  
>  	most_deregister_configfs_subsys(&comp);
>  	most_deregister_component(&comp);
> -	BUG_ON(!list_empty(&video_devices));
> +	WARN_ON_ONCE(!list_empty(&video_devices));

When the race condition is fixed, then we can just remove this.

regards,
dan carpenter


      parent reply	other threads:[~2025-11-26 17:49 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
2025-11-26 17:48 ` Dan Carpenter [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=aSc9bvj9is1c-FUB@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=christian.gromm@microchip.com \
    --cc=gregkh@linuxfoundation.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 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.