[CRIU] [PATCH] mount: don't close a namespace descriptor two times

Pavel Emelyanov xemul at parallels.com
Tue Sep 3 05:59:17 EDT 2013


On 09/03/2013 12:48 AM, Andrey Vagin wrote:
> CID null (#1 of 1): Double close (USE_AFTER_FREE)
> 10. double_close: Calling "restore_ns(int, struct ns_desc *)" closes
> handle "ns_old" which has already been closed.
> 
> Signed-off-by: Andrey Vagin <avagin at openvz.org>
> ---
>  mount.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/mount.c b/mount.c
> index 9abbe95..44e33bd 100644
> --- a/mount.c
> +++ b/mount.c
> @@ -455,8 +455,10 @@ static DIR *open_mountpoint(struct mount_info *pm)
>  	if (fd < 0)
>  		goto out;
>  
> -	if (restore_ns(ns_old, &mnt_ns_desc))
> +	if (restore_ns(ns_old, &mnt_ns_desc)) {
> +		ns_old = -1;
>  		goto out;
> +	}
>  
>  	return __open_mountpoint(pm, fd);;
>  out:
> 

applied


More information about the CRIU mailing list