diff options
| author | Jason Baron <jbaron@redhat.com> | 2004-11-07 04:06:32 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-11-07 04:06:32 -0800 |
| commit | 4b44897435a4e907b87cb14501c04d593f2323d8 (patch) | |
| tree | 346ebb87fc0a57fd0a722124c6122dc55e2fb3a0 /include/linux | |
| parent | 1eccda347986a26bb4dd65c8dfee03da71de3fa8 (diff) | |
[PATCH] fix alt-sysrq deadlock
The sysrq code is taking a spinlock from both interrupt and process context
in an unsafe and deadlocky manner.
Move all those inlined functions out of sysrq.h, into sysrq.c then withdraw
all those exported-to-modules helper functions then remove
__sysrq_trylock_table() altogether and then use spin_lock_irqsave() in the
appropriate places.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/sysrq.h | 45 |
1 files changed, 2 insertions, 43 deletions
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h index 7fe8012f79f9..94cbe97bd8e6 100644 --- a/include/linux/sysrq.h +++ b/include/linux/sysrq.h @@ -31,49 +31,8 @@ struct sysrq_key_op { void handle_sysrq(int, struct pt_regs *, struct tty_struct *); void __handle_sysrq(int, struct pt_regs *, struct tty_struct *); - -/* - * Sysrq registration manipulation functions - */ - -void __sysrq_lock_table (void); -void __sysrq_unlock_table (void); -struct sysrq_key_op *__sysrq_get_key_op (int key); -void __sysrq_put_key_op (int key, struct sysrq_key_op *op_p); - -extern __inline__ int -__sysrq_swap_key_ops_nolock(int key, struct sysrq_key_op *insert_op_p, - struct sysrq_key_op *remove_op_p) -{ - int retval; - if (__sysrq_get_key_op(key) == remove_op_p) { - __sysrq_put_key_op(key, insert_op_p); - retval = 0; - } else { - retval = -1; - } - return retval; -} - -extern __inline__ int -__sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p, - struct sysrq_key_op *remove_op_p) { - int retval; - __sysrq_lock_table(); - retval = __sysrq_swap_key_ops_nolock(key, insert_op_p, remove_op_p); - __sysrq_unlock_table(); - return retval; -} - -static inline int register_sysrq_key(int key, struct sysrq_key_op *op_p) -{ - return __sysrq_swap_key_ops(key, op_p, NULL); -} - -static inline int unregister_sysrq_key(int key, struct sysrq_key_op *op_p) -{ - return __sysrq_swap_key_ops(key, NULL, op_p); -} +int register_sysrq_key(int, struct sysrq_key_op *); +int unregister_sysrq_key(int, struct sysrq_key_op *); #else |
