aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2006-09-29 04:58:52 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-29 12:18:04 -0400
commitf92afe56a0dcd271cb94e12acf1861d44c3faefd (patch)
tree4c8fc05c2dd6d9142ab3e5850ccbb5ff7b0065d1
parent80c13749140284abdc23bbeed2507b7e5a3dc459 (diff)
[PATCH] uml: stack consumption reduction
Fix some stack abuse in the sysrq t path. Signed-off-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/um/drivers/mconsole_kern.c15
-rw-r--r--arch/um/drivers/mconsole_user.c4
2 files changed, 14 insertions, 5 deletions
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 79610b5ce67e..773a134e7fdb 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -598,6 +598,11 @@ out:
598 mconsole_reply(req, err_msg, err, 0); 598 mconsole_reply(req, err_msg, err, 0);
599} 599}
600 600
601struct mconsole_output {
602 struct list_head list;
603 struct mc_request *req;
604};
605
601static DEFINE_SPINLOCK(console_lock); 606static DEFINE_SPINLOCK(console_lock);
602static LIST_HEAD(clients); 607static LIST_HEAD(clients);
603static char console_buf[MCONSOLE_MAX_DATA]; 608static char console_buf[MCONSOLE_MAX_DATA];
@@ -622,10 +627,10 @@ static void console_write(struct console *console, const char *string,
622 return; 627 return;
623 628
624 list_for_each(ele, &clients){ 629 list_for_each(ele, &clients){
625 struct mconsole_entry *entry; 630 struct mconsole_output *entry;
626 631
627 entry = list_entry(ele, struct mconsole_entry, list); 632 entry = list_entry(ele, struct mconsole_output, list);
628 mconsole_reply_len(&entry->request, console_buf, 633 mconsole_reply_len(entry->req, console_buf,
629 console_index, 0, 1); 634 console_index, 0, 1);
630 } 635 }
631 636
@@ -649,10 +654,10 @@ late_initcall(mc_add_console);
649static void with_console(struct mc_request *req, void (*proc)(void *), 654static void with_console(struct mc_request *req, void (*proc)(void *),
650 void *arg) 655 void *arg)
651{ 656{
652 struct mconsole_entry entry; 657 struct mconsole_output entry;
653 unsigned long flags; 658 unsigned long flags;
654 659
655 entry.request = *req; 660 entry.req = req;
656 list_add(&entry.list, &clients); 661 list_add(&entry.list, &clients);
657 spin_lock_irqsave(&console_lock, flags); 662 spin_lock_irqsave(&console_lock, flags);
658 663
diff --git a/arch/um/drivers/mconsole_user.c b/arch/um/drivers/mconsole_user.c
index 5b2f5fe9e426..17068eb746c0 100644
--- a/arch/um/drivers/mconsole_user.c
+++ b/arch/um/drivers/mconsole_user.c
@@ -131,6 +131,10 @@ int mconsole_get_request(int fd, struct mc_request *req)
131int mconsole_reply_len(struct mc_request *req, const char *str, int total, 131int mconsole_reply_len(struct mc_request *req, const char *str, int total,
132 int err, int more) 132 int err, int more)
133{ 133{
134 /* XXX This is a stack consumption problem. It'd be nice to
135 * make it global and serialize access to it, but there are a
136 * ton of callers to this function.
137 */
134 struct mconsole_reply reply; 138 struct mconsole_reply reply;
135 int len, n; 139 int len, n;
136 140