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: <20230530164712.GB22516@pendragon.ideasonboard.com>
Date:   Tue, 30 May 2023 19:47:12 +0300
From:   Laurent Pinchart <laurent.pinchart@...asonboard.com>
To:     Philipp Zabel <p.zabel@...gutronix.de>
Cc:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        Sakari Ailus <sakari.ailus@...ux.intel.com>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel@...gutronix.de
Subject: Re: [PATCH 1/2] media: video-mux: fix error paths

Hi Philipp,

Thank you for the patch.

On Wed, May 24, 2023 at 03:29:24PM +0200, Philipp Zabel wrote:
> Move notifier cleanup into video_mux_async_register() to avoid calling
> v4l2_async_nf_unregister() when v4l2_async_subdev_nf_register() failed.
> In case video_mux_async_register() fails, call media_entity_cleanup().
> 
> Signed-off-by: Philipp Zabel <p.zabel@...gutronix.de>

Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>

> ---
>  drivers/media/platform/video-mux.c | 26 +++++++++++++++++++-------
>  1 file changed, 19 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/media/platform/video-mux.c b/drivers/media/platform/video-mux.c
> index 1d9f32e5a917..4fe31386afc7 100644
> --- a/drivers/media/platform/video-mux.c
> +++ b/drivers/media/platform/video-mux.c
> @@ -389,7 +389,7 @@ static int video_mux_async_register(struct video_mux *vmux,
>  			ret = PTR_ERR(asd);
>  			/* OK if asd already exists */
>  			if (ret != -EEXIST)
> -				return ret;
> +				goto err_nf_cleanup;
>  		}
>  	}
>  
> @@ -397,9 +397,19 @@ static int video_mux_async_register(struct video_mux *vmux,
>  
>  	ret = v4l2_async_subdev_nf_register(&vmux->subdev, &vmux->notifier);
>  	if (ret)
> -		return ret;
> +		goto err_nf_cleanup;
>  
> -	return v4l2_async_register_subdev(&vmux->subdev);
> +	ret = v4l2_async_register_subdev(&vmux->subdev);
> +	if (ret)
> +		goto err_nf_unregister;
> +
> +	return 0;
> +
> +err_nf_unregister:
> +	v4l2_async_nf_unregister(&vmux->notifier);
> +err_nf_cleanup:
> +	v4l2_async_nf_cleanup(&vmux->notifier);
> +	return ret;
>  }
>  
>  static int video_mux_probe(struct platform_device *pdev)
> @@ -473,11 +483,13 @@ static int video_mux_probe(struct platform_device *pdev)
>  	vmux->subdev.entity.ops = &video_mux_ops;
>  
>  	ret = video_mux_async_register(vmux, num_pads - 1);
> -	if (ret) {
> -		v4l2_async_nf_unregister(&vmux->notifier);
> -		v4l2_async_nf_cleanup(&vmux->notifier);
> -	}
> +	if (ret)
> +		goto err_entity_cleanup;
>  
> +	return 0;
> +
> +err_entity_cleanup:
> +	media_entity_cleanup(&vmux->subdev.entity);
>  	return ret;
>  }
>  
> 

-- 
Regards,

Laurent Pinchart

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ