public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Neil Horman <nhorman@tuxdriver.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH] coredump: fix va_list corruption
Date: Sat, 19 Apr 2014 20:04:21 +0200	[thread overview]
Message-ID: <20140419180421.GA982@redhat.com> (raw)
In-Reply-To: <1397927707.19600.20.camel@edumazet-glaptop2.roam.corp.google.com>

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@redhat.com>


  reply	other threads:[~2014-04-19 18:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-19 17:15 [PATCH] coredump: fix va_list corruption Eric Dumazet
2014-04-19 18:04 ` Oleg Nesterov [this message]
2014-04-19 23:14 ` Neil Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140419180421.GA982@redhat.com \
    --to=oleg@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=eric.dumazet@gmail.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox