[CRIU] [PATCH] criu: pstree_switch_state -- Fix nil deref on error path

Pavel Emelyanov xemul at virtuozzo.com
Wed Mar 16 07:24:24 PDT 2016


On 03/16/2016 11:52 AM, Cyrill Gorcunov wrote:
> We may enter with @root_item = NULL in case of error
> handling, so simply bail out.

Hm... How can this happen?

> Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
> ---
>  criu/seize.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/criu/seize.c b/criu/seize.c
> index d187b74..0606586 100644
> --- a/criu/seize.c
> +++ b/criu/seize.c
> @@ -463,6 +463,9 @@ void pstree_switch_state(struct pstree_item *root_item, int st)
>  {
>  	struct pstree_item *item = root_item;
>  
> +	if (!root_item)
> +		return;
> +
>  	if (st != TASK_DEAD)
>  		freezer_restore_state();
>  
> 



More information about the CRIU mailing list