From: Takashi Iwai Date: Tue, 24 Oct 2006 12:55:46 +0000 (+0200) Subject: [PATCH] ALSA: Fix re-use of va_list X-Git-Tag: v2.6.18.2~36 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e4007bf4ef92fc6d2afa418c1b49921a7c7d0b3;p=thirdparty%2Fkernel%2Fstable.git [PATCH] ALSA: Fix re-use of va_list The va_list is designed to be used only once. The current code may pass va_list arguments multiple times and may cause Oops. Copy/release the arguments temporarily to avoid this problem. Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Signed-off-by: Chris Wright --- diff --git a/sound/core/info.c b/sound/core/info.c index 340332c6d9733..57821ceb17b4b 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -119,7 +119,10 @@ int snd_iprintf(struct snd_info_buffer *buffer, char *fmt,...) len = buffer->len - buffer->size; va_start(args, fmt); for (;;) { - res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, args); + va_list ap; + va_copy(ap, args); + res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, ap); + va_end(ap); if (res < len) break; err = resize_info_buffer(buffer, buffer->len + PAGE_SIZE);