[CRIU] [PATCH 1/2] ids: Make sure root ids is present in image

Pavel Emelyanov xemul at parallels.com
Fri Mar 15 05:41:11 EDT 2013


On 03/15/2013 12:50 AM, Cyrill Gorcunov wrote:
> Otherwise yield error instead of nil dereference.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  pstree.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/pstree.c b/pstree.c
> index 5bfcbdc..4f4d938 100644
> --- a/pstree.c
> +++ b/pstree.c
> @@ -494,9 +494,19 @@ static int prepare_pstree_kobj_ids(void)
>  
>  		if (parent)
>  			ids = parent->ids;
> -		else
> +		else {
>  			ids = root_ids;
>  
> +			/*
> +			 * Add some sanity check on image data.
> +			 */
> +			if (unlikely(!ids)) {

The if (!ids) should be checked for parent->ids case as well.

> +				pr_err("No root-kIDs provided, "
> +				       "image corruption\n");
> +				return -1;
> +			}
> +		}
> +
>  		cflags = get_clone_mask(item->ids, ids);
>  
>  		if (cflags & CLONE_FILES) {
> 




More information about the CRIU mailing list