Re: [PATCH] coredump: fix va_list corruption

From: Oleg Nesterov
Date: Sat Apr 19 2014 - 14:04:50 EST


On 04/19, Eric Dumazet wrote:
>
> A va_list needs to be copied in case it needs to be used twice.

OOPS :/

> --- a/fs/coredump.c
> +++ b/fs/coredump.c
> @@ -73,10 +73,15 @@ static int expand_corename(struct core_name *cn, int size)
> static int cn_vprintf(struct core_name *cn, const char *fmt, va_list arg)
> {
> int free, need;
> + va_list arg_copy;
>
> again:
> free = cn->size - cn->used;
> - need = vsnprintf(cn->corename + cn->used, free, fmt, arg);
> +
> + va_copy(arg_copy, arg);
> + need = vsnprintf(cn->corename + cn->used, free, fmt, arg_copy);
> + va_end(arg_copy);
> +

Thanks!

Acked-by: Oleg Nesterov <oleg@xxxxxxxxxx>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/