LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Tejun Heo <htejun@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Randy Dunlap <randy.dunlap@oracle.com>,
Linux Kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH UPDATED] printk: fix possible printk buffer overrun introduced with recursion check
Date: Thu, 14 Feb 2008 10:32:07 +0900 [thread overview]
Message-ID: <47B39A17.9080509@gmail.com> (raw)
In-Reply-To: <47B38718.4030509@gmail.com>
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 buffer overrun in
extreme cases. Fix it.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Acked-by: Ingo Molnar <mingo@elte.hu>
---
Splitted out fix portion.
kernel/printk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/printk.c b/kernel/printk.c
index bee3610..9adc2a4 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -666,7 +666,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
}
/* 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
next prev parent reply other threads:[~2008-02-14 1:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-13 8:46 [PATCH REPOST] " Tejun Heo
2008-02-13 12:45 ` Ingo Molnar
2008-02-14 0:11 ` Tejun Heo
2008-02-14 1:32 ` Tejun Heo [this message]
2008-02-14 1:39 ` [PATCH] printk: clean up recursion check related static variables Tejun Heo
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=47B39A17.9080509@gmail.com \
--to=htejun@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=randy.dunlap@oracle.com \
--cc=torvalds@linux-foundation.org \
--subject='Re: [PATCH UPDATED] printk: fix possible printk buffer overrun introduced with recursion check' \
/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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).