public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Edward Adam Davis <eadavis@qq.com>
Cc: syzbot+031d0cfd7c362817963f@syzkaller.appspotmail.com,
	linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
	mchehab@kernel.org, sakari.ailus@linux.intel.com,
	syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH Next] media: mc: Clear minor number before put device
Date: Wed, 10 Sep 2025 12:22:33 +0300	[thread overview]
Message-ID: <20250910092233.GA20904@pendragon.ideasonboard.com> (raw)
In-Reply-To: <tencent_341BA32545BAFBBB2133249EDE1B774B4908@qq.com>

Hello Edward,

On Wed, Sep 10, 2025 at 09:15:27AM +0800, Edward Adam Davis wrote:
> The device minor should not be cleared after the device is released.

The most important piece of information in a commit message is the
reason for the patch. You need to explain *why* this is needed, not just
state it should be done.

> Fixes: 9e14868dc952 ("media: mc: Clear minor number reservation at unregistration time")
> Reported-by: syzbot+031d0cfd7c362817963f@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=031d0cfd7c362817963f
> Tested-by: syzbot+031d0cfd7c362817963f@syzkaller.appspotmail.com
> Signed-off-by: Edward Adam Davis <eadavis@qq.com>
> ---
>  drivers/media/mc/mc-devnode.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/media/mc/mc-devnode.c b/drivers/media/mc/mc-devnode.c
> index 0d01cbae98f2..6daa7aa99442 100644
> --- a/drivers/media/mc/mc-devnode.c
> +++ b/drivers/media/mc/mc-devnode.c
> @@ -276,13 +276,10 @@ void media_devnode_unregister(struct media_devnode *devnode)
>  	/* Delete the cdev on this minor as well */
>  	cdev_device_del(&devnode->cdev, &devnode->dev);
>  	devnode->media_dev = NULL;
> +	clear_bit(devnode->minor, media_devnode_nums);
>  	mutex_unlock(&media_devnode_lock);
>  
>  	put_device(&devnode->dev);
> -
> -	mutex_lock(&media_devnode_lock);
> -	clear_bit(devnode->minor, media_devnode_nums);
> -	mutex_unlock(&media_devnode_lock);
>  }
>  
>  /*

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2025-09-10  9:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-09 21:10 [syzbot] [media?] KASAN: slab-use-after-free Read in media_devnode_unregister syzbot
2025-09-10  0:42 ` Edward Adam Davis
2025-09-10  1:09   ` syzbot
2025-09-10  1:15 ` [PATCH Next] media: mc: Clear minor number before put device Edward Adam Davis
2025-09-10  9:22   ` Laurent Pinchart [this message]
2025-09-10 10:31     ` [PATCH Next V2] " Edward Adam Davis
2025-09-11 10:43       ` Sakari Ailus

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=20250910092233.GA20904@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=syzbot+031d0cfd7c362817963f@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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