[CRIU] [PATCH] fsnotify: Fix bad field name in list iterations

Andrei Vagin avagin at virtuozzo.com
Thu Jun 22 00:24:57 MSK 2017


Applied, thanks!
On Mon, Jun 19, 2017 at 05:03:30PM +0300, Pavel Emelyanov wrote:
> Surprisingly, but
> 
> offsetof(inotify_wd_entry, node) == offsetof(fanotify_mark_entry, node)
> 
> even though both structures have node field in the middle and the
> fields sitting above one are totally different.
> 
> So the code works, but ... we're risking :)
> 
> Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
> ---
>  criu/fsnotify.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/criu/fsnotify.c b/criu/fsnotify.c
> index e3d62e5..3c71bf3 100644
> --- a/criu/fsnotify.c
> +++ b/criu/fsnotify.c
> @@ -468,7 +468,7 @@ static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p)
>  		goto free;
>  
>  	i = 0;
> -	list_for_each_entry(we, &wd_list.list, ify.node)
> +	list_for_each_entry(we, &wd_list.list, ffy.node)
>  		fe.mark[i++] = &we->ffy.e;
>  	fe.n_mark = wd_list.n;
>  
> @@ -480,7 +480,7 @@ static int dump_one_fanotify(int lfd, u32 id, const struct fd_parms *p)
>  	ret = pb_write_one(img_from_set(glob_imgset, CR_FD_FANOTIFY_FILE), &fe, PB_FANOTIFY_FILE);
>  free:
>  	xfree(fe.mark);
> -	list_for_each_entry_safe(we, tmp, &wd_list.list, ify.node)
> +	list_for_each_entry_safe(we, tmp, &wd_list.list, ffy.node)
>  		free_fanotify_mark_entry(we);
>  	return ret;
>  }
> -- 
> 2.1.4
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu


More information about the CRIU mailing list