lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <36261b27-99b9-4e9e-ac1c-87c06c6dc0bd@jjverkuil.nl>
Date: Fri, 25 Apr 2025 13:18:44 +0200
From: Hans Verkuil <hans@...erkuil.nl>
To: Michał Mirosław <mirq-linux@...e.qmqm.pl>,
 Mauro Carvalho Chehab <mchehab@...nel.org>,
 Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: v4l: get_device() when no errors are possible
 anymore

Hi Michał,

On 28/03/2025 23:07, Michał Mirosław wrote:
> Avoid leaking reference from get_device() in the error path.

It's not actually leaking anything. If dev == NULL, then get_device
does nothing.

I'll reject this patch.

Regards,

	Hans

> 
> Signed-off-by: Michał Mirosław <mirq-linux@...e.qmqm.pl>
> ---
>  drivers/media/v4l2-core/v4l2-device.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c
> index 5e537454f5cd..277ea2c241b8 100644
> --- a/drivers/media/v4l2-core/v4l2-device.c
> +++ b/drivers/media/v4l2-core/v4l2-device.c
> @@ -23,7 +23,6 @@ int v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev)
>  	spin_lock_init(&v4l2_dev->lock);
>  	v4l2_prio_init(&v4l2_dev->prio);
>  	kref_init(&v4l2_dev->ref);
> -	get_device(dev);
>  	v4l2_dev->dev = dev;
>  	if (dev == NULL) {
>  		/* If dev == NULL, then name must be filled in by the caller */
> @@ -32,6 +31,8 @@ int v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev)
>  		return 0;
>  	}
>  
> +	get_device(dev);
> +
>  	/* Set name to driver name + device name if it is empty. */
>  	if (!v4l2_dev->name[0])
>  		snprintf(v4l2_dev->name, sizeof(v4l2_dev->name), "%s %s",


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ