Commit dd3871ec authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Make /proc/sysrq-trigger ignore sysrq_enabled

It's silly that writing to /proc/sysrq-trigger does nothing if you haven't
enabled /proc/sys/kernel/sysrq.  So provide a new __handle_sysrq() which
ignores the sysrq_enabled check.

The patch also withdraws __handle_sysrq_nolock() from the kernel API.  It had
no callers.
parent 04229e50
...@@ -312,37 +312,19 @@ void __sysrq_put_key_op (int key, struct sysrq_key_op *op_p) { ...@@ -312,37 +312,19 @@ void __sysrq_put_key_op (int key, struct sysrq_key_op *op_p) {
sysrq_key_table[i] = op_p; sysrq_key_table[i] = op_p;
} }
/*
* This function is called by the keyboard handler when SysRq is pressed
* and any other keycode arrives.
*/
void handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty)
{
if (!sysrq_enabled)
return;
__sysrq_lock_table();
__handle_sysrq_nolock(key, pt_regs, tty);
__sysrq_unlock_table();
}
/* /*
* This is the non-locking version of handle_sysrq * This is the non-locking version of handle_sysrq
* It must/can only be called by sysrq key handlers, * It must/can only be called by sysrq key handlers,
* as they are inside of the lock * as they are inside of the lock
*/ */
void __handle_sysrq_nolock(int key, struct pt_regs *pt_regs, void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty)
struct tty_struct *tty)
{ {
struct sysrq_key_op *op_p; struct sysrq_key_op *op_p;
int orig_log_level; int orig_log_level;
int i, j; int i, j;
if (!sysrq_enabled)
return;
__sysrq_lock_table();
orig_log_level = console_loglevel; orig_log_level = console_loglevel;
console_loglevel = 7; console_loglevel = 7;
printk(KERN_INFO "SysRq : "); printk(KERN_INFO "SysRq : ");
...@@ -364,10 +346,22 @@ void __handle_sysrq_nolock(int key, struct pt_regs *pt_regs, ...@@ -364,10 +346,22 @@ void __handle_sysrq_nolock(int key, struct pt_regs *pt_regs,
printk ("\n"); printk ("\n");
console_loglevel = orig_log_level; console_loglevel = orig_log_level;
} }
__sysrq_unlock_table();
}
/*
* This function is called by the keyboard handler when SysRq is pressed
* and any other keycode arrives.
*/
void handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty)
{
if (!sysrq_enabled)
return;
__handle_sysrq(key, pt_regs, tty);
} }
EXPORT_SYMBOL(handle_sysrq); EXPORT_SYMBOL(handle_sysrq);
EXPORT_SYMBOL(__handle_sysrq_nolock);
EXPORT_SYMBOL(__sysrq_lock_table); EXPORT_SYMBOL(__sysrq_lock_table);
EXPORT_SYMBOL(__sysrq_unlock_table); EXPORT_SYMBOL(__sysrq_unlock_table);
EXPORT_SYMBOL(__sysrq_get_key_op); EXPORT_SYMBOL(__sysrq_get_key_op);
......
...@@ -631,7 +631,7 @@ static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf, ...@@ -631,7 +631,7 @@ static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
if (get_user(c, buf)) if (get_user(c, buf))
return -EFAULT; return -EFAULT;
handle_sysrq(c, NULL, NULL); __handle_sysrq(c, NULL, NULL);
} }
return count; return count;
} }
......
...@@ -30,13 +30,7 @@ struct sysrq_key_op { ...@@ -30,13 +30,7 @@ struct sysrq_key_op {
*/ */
void handle_sysrq(int, struct pt_regs *, struct tty_struct *); void handle_sysrq(int, struct pt_regs *, struct tty_struct *);
void __handle_sysrq(int, struct pt_regs *, struct tty_struct *);
/*
* Nonlocking version of handle sysrq, used by sysrq handlers that need to
* call sysrq handlers
*/
void __handle_sysrq_nolock(int, struct pt_regs *, struct tty_struct *);
/* /*
* Sysrq registration manipulation functions * Sysrq registration manipulation functions
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment