forked from luck/tmp_suning_uos_patched
[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>
This commit is contained in:
parent
80c1374914
commit
f92afe56a0
|
@ -598,6 +598,11 @@ void mconsole_remove(struct mc_request *req)
|
||||||
mconsole_reply(req, err_msg, err, 0);
|
mconsole_reply(req, err_msg, err, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct mconsole_output {
|
||||||
|
struct list_head list;
|
||||||
|
struct mc_request *req;
|
||||||
|
};
|
||||||
|
|
||||||
static DEFINE_SPINLOCK(console_lock);
|
static DEFINE_SPINLOCK(console_lock);
|
||||||
static LIST_HEAD(clients);
|
static LIST_HEAD(clients);
|
||||||
static char console_buf[MCONSOLE_MAX_DATA];
|
static char console_buf[MCONSOLE_MAX_DATA];
|
||||||
|
@ -622,10 +627,10 @@ static void console_write(struct console *console, const char *string,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
list_for_each(ele, &clients){
|
list_for_each(ele, &clients){
|
||||||
struct mconsole_entry *entry;
|
struct mconsole_output *entry;
|
||||||
|
|
||||||
entry = list_entry(ele, struct mconsole_entry, list);
|
entry = list_entry(ele, struct mconsole_output, list);
|
||||||
mconsole_reply_len(&entry->request, console_buf,
|
mconsole_reply_len(entry->req, console_buf,
|
||||||
console_index, 0, 1);
|
console_index, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,10 +654,10 @@ late_initcall(mc_add_console);
|
||||||
static void with_console(struct mc_request *req, void (*proc)(void *),
|
static void with_console(struct mc_request *req, void (*proc)(void *),
|
||||||
void *arg)
|
void *arg)
|
||||||
{
|
{
|
||||||
struct mconsole_entry entry;
|
struct mconsole_output entry;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
entry.request = *req;
|
entry.req = req;
|
||||||
list_add(&entry.list, &clients);
|
list_add(&entry.list, &clients);
|
||||||
spin_lock_irqsave(&console_lock, flags);
|
spin_lock_irqsave(&console_lock, flags);
|
||||||
|
|
||||||
|
|
|
@ -131,6 +131,10 @@ int mconsole_get_request(int fd, struct mc_request *req)
|
||||||
int mconsole_reply_len(struct mc_request *req, const char *str, int total,
|
int mconsole_reply_len(struct mc_request *req, const char *str, int total,
|
||||||
int err, int more)
|
int err, int more)
|
||||||
{
|
{
|
||||||
|
/* XXX This is a stack consumption problem. It'd be nice to
|
||||||
|
* make it global and serialize access to it, but there are a
|
||||||
|
* ton of callers to this function.
|
||||||
|
*/
|
||||||
struct mconsole_reply reply;
|
struct mconsole_reply reply;
|
||||||
int len, n;
|
int len, n;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user