[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20080225155038.GA25423@elte.hu>
Date: Mon, 25 Feb 2008 16:50:38 +0100
From: Ingo Molnar <mingo@...e.hu>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org
Subject: [patch] printk: fix possible printk overrun
Subject: printk: fix possible printk overrun
From: Tejun Heo <htejun@...il.com>
Date: Thu, 14 Feb 2008 10:32:07 +0900
printk recursion detection prepends message to printk_buf and offsets
printk_buf when actual message is printed but it forgets to trim buffer
length accordingly. This can result in overrun in extreme cases. Fix it.
[ mingo@...e.hu:
bug was introduced by me via:
commit 32a76006683f7b28ae3cc491da37716e002f198e
Author: Ingo Molnar <mingo@...e.hu>
Date: Fri Jan 25 21:07:58 2008 +0100
printk: make printk more robust by not allowing recursion
]
Signed-off-by: Tejun Heo <htejun@...il.com>
Signed-off-by: Ingo Molnar <mingo@...e.hu>
---
kernel/printk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux/kernel/printk.c
===================================================================
--- linux.orig/kernel/printk.c
+++ linux/kernel/printk.c
@@ -666,7 +666,7 @@ asmlinkage int vprintk(const char *fmt,
}
/* Emit the output into the temporary buffer */
printed_len += vscnprintf(printk_buf + printed_len,
- sizeof(printk_buf), fmt, args);
+ sizeof(printk_buf) - printed_len, fmt, args);
/*
* Copy the output into log_buf. If the caller didn't provide
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists