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] [thread-next>] [day] [month] [year] [list]
Message-ID: <6a9e7d6d-2054-45da-943f-e95bc6261c42@wanadoo.fr>
Date: Wed, 10 Jan 2024 20:15:46 +0100
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Nikita Zhandarovich <n.zhandarovich@...tech.ru>,
 Mauro Carvalho Chehab <mchehab@...nel.org>
Cc: linux-media@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] media: em28xx: return error on media_device_register()
 failure

Le 10/01/2024 à 18:39, Nikita Zhandarovich a écrit :
> In an unlikely case of failure in media_device_register(), release
> resources and return the erroneous value. Otherwise, possible issues
> with registering the device will continue to be ignored.
> 
> Found by Linux Verification Center (linuxtesting.org) with static
> analysis tool SVACE.
> 
> Fixes: 37ecc7b1278f ("[media] em28xx: add media controller support")
> Signed-off-by: Nikita Zhandarovich <n.zhandarovich@...tech.ru>
> ---
>   drivers/media/usb/em28xx/em28xx-cards.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
> index 4d037c92af7c..dae731dfc569 100644
> --- a/drivers/media/usb/em28xx/em28xx-cards.c
> +++ b/drivers/media/usb/em28xx/em28xx-cards.c
> @@ -4095,6 +4095,8 @@ static int em28xx_usb_probe(struct usb_interface *intf,
>   	 */
>   #ifdef CONFIG_MEDIA_CONTROLLER
>   	retval = media_device_register(dev->media_dev);
> +	if (retval)
> +		goto err_free;
>   #endif
>   
>   	return 0;
> 
> 
Hi,

I think that some resources allocated in em28xx_init_dev() should also 
be freed if media_device_register() fails. (see the error handling path 
at the end of em28xx_init_dev())

Just my 2c.

CJ

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ