[CRIU] [PATCH] service: fix bug, when root_item isn't initialized

Pavel Emelyanov xemul at parallels.com
Wed Dec 18 09:18:19 PST 2013


On 12/18/2013 03:28 PM, Ruslan Kuprieiev wrote:
> If restore fails on early stage(like no images in directory), then root_item
> might be uninitialized, so when we are trying to send response with root_item->pid
> criu crashes.
> 
> Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
> ---
>  cr-service.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/cr-service.c b/cr-service.c
> index 2fa89a5..bf780dd 100644
> --- a/cr-service.c
> +++ b/cr-service.c
> @@ -212,7 +212,8 @@ static int restore_using_req(int sk, CriuOpts *req)
>  
>  	success = true;
>  exit:
> -	if (send_criu_restore_resp(sk, success, root_item->pid.real) == -1) {
> +	if (send_criu_restore_resp(sk, success,
> +				   root_item ? root_item->pid.real : -1) == -1) {
>  		pr_perror("Can't send response");
>  		success = false;
>  	}
> 
applied



More information about the CRIU mailing list