mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil+cisco@kernel.org>
To: Farhad Alemi <farhad.alemi@berkeley.edu>,
	Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: falemi@asu.edu, linux-media@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: cx231xx: don't free the media device on err_analog
Date: Tue, 22 Sep 2026 16:43:39 +0200	[thread overview]
Message-ID: <da233f60-1109-487a-8e40-2dc34187bb44@kernel.org> (raw)
In-Reply-To: <CA+0ovChNv1=1dfdKxSXnBN0KVC6eO6kZqTFTsozOoJYCvT8T4g@mail.gmail.com>

On 11/09/2026 07:48, Farhad Alemi wrote:
> When cx231xx_register_analog_devices() fails, cx231xx_init_dev() jumps to
> err_analog and calls cx231xx_unregister_media_device(), which frees
> dev->media_dev while dev->v4l2_dev.mdev still aliases it. The next line,
> cx231xx_release_analog_resources(), releases the video device, so
> v4l2_device_release() takes the freed media device's graph_mutex in
> media_devnode_remove(). Remove that free from err_analog and leave it to
> cx231xx_usb_probe(), which frees the media device at err_v4l2, after
> cx231xx_release_analog_resources() has released the video devices and
> v4l2_device_unregister() has dropped the subdevs.
> 
> Signed-off-by: Farhad Alemi <farhad.alemi@berkeley.edu>
> ---
> The device was emulated.
> 

This patch doesn't apply, you're missing a
---

line here.

> --- a/drivers/media/usb/cx231xx/cx231xx-cards.c
> +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c
> @@ -1505,7 +1505,7 @@ static int cx231xx_init_dev(struct cx231xx *dev,
> struct usb_device *udev,

And this is mangled.

You need to get your mail settings sorted first so it doesn't mess up
patches.

Regards,

	Hans

> 
>  	return 0;
>  err_analog:
> -	cx231xx_unregister_media_device(dev);
> +	/* dev->v4l2_dev.mdev aliases media_dev until probe's err_v4l2 frees it. */
>  	cx231xx_release_analog_resources(dev);
>  	cx231xx_remove_from_devlist(dev);
>  err_dev_init:
> 


      reply	other threads:[~2026-09-22 14:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-11  5:48 Farhad Alemi
2026-09-22 14:43 ` Hans Verkuil [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=da233f60-1109-487a-8e40-2dc34187bb44@kernel.org \
    --to=hverkuil+cisco@kernel.org \
    --cc=falemi@asu.edu \
    --cc=farhad.alemi@berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@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®