diff options
author | Richard Weinberger <richard@nod.at> | 2016-06-12 16:03:16 -0400 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2016-08-03 18:17:58 -0400 |
commit | 57a05d83b16710aff30510c33768df7ab17e0b4a (patch) | |
tree | b8535f4cb6462564b41c8e8deedde84868991874 | |
parent | 5609a3d309836d047eb60275db69d82d47268283 (diff) |
um: Fix possible deadlock in sig_handler_common()
We are in atomic context and must not sleep.
Sleeping here is possible since malloc() maps
to kmalloc() with GFP_KERNEL.
Cc: stable@vger.kernel.org
Fixes: b6024b21 ("um: extend fpstate to _xstate to support YMM registers")
Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r-- | arch/um/os-Linux/signal.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c index 8acaf4e384c0..a86d7cc2c2d8 100644 --- a/arch/um/os-Linux/signal.c +++ b/arch/um/os-Linux/signal.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <kern_util.h> | 15 | #include <kern_util.h> |
16 | #include <os.h> | 16 | #include <os.h> |
17 | #include <sysdep/mcontext.h> | 17 | #include <sysdep/mcontext.h> |
18 | #include <um_malloc.h> | ||
18 | 19 | ||
19 | void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = { | 20 | void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = { |
20 | [SIGTRAP] = relay_signal, | 21 | [SIGTRAP] = relay_signal, |
@@ -32,7 +33,7 @@ static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc) | |||
32 | struct uml_pt_regs *r; | 33 | struct uml_pt_regs *r; |
33 | int save_errno = errno; | 34 | int save_errno = errno; |
34 | 35 | ||
35 | r = malloc(sizeof(struct uml_pt_regs)); | 36 | r = uml_kmalloc(sizeof(struct uml_pt_regs), UM_GFP_ATOMIC); |
36 | if (!r) | 37 | if (!r) |
37 | panic("out of memory"); | 38 | panic("out of memory"); |
38 | 39 | ||
@@ -91,7 +92,7 @@ static void timer_real_alarm_handler(mcontext_t *mc) | |||
91 | { | 92 | { |
92 | struct uml_pt_regs *regs; | 93 | struct uml_pt_regs *regs; |
93 | 94 | ||
94 | regs = malloc(sizeof(struct uml_pt_regs)); | 95 | regs = uml_kmalloc(sizeof(struct uml_pt_regs), UM_GFP_ATOMIC); |
95 | if (!regs) | 96 | if (!regs) |
96 | panic("out of memory"); | 97 | panic("out of memory"); |
97 | 98 | ||