Commit 57a05d83 authored by Richard Weinberger's avatar Richard Weinberger

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: default avatarRichard Weinberger <richard@nod.at>
parent 5609a3d3
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <kern_util.h> #include <kern_util.h>
#include <os.h> #include <os.h>
#include <sysdep/mcontext.h> #include <sysdep/mcontext.h>
#include <um_malloc.h>
void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = { void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = {
[SIGTRAP] = relay_signal, [SIGTRAP] = relay_signal,
...@@ -32,7 +33,7 @@ static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc) ...@@ -32,7 +33,7 @@ static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc)
struct uml_pt_regs *r; struct uml_pt_regs *r;
int save_errno = errno; int save_errno = errno;
r = malloc(sizeof(struct uml_pt_regs)); r = uml_kmalloc(sizeof(struct uml_pt_regs), UM_GFP_ATOMIC);
if (!r) if (!r)
panic("out of memory"); panic("out of memory");
...@@ -91,7 +92,7 @@ static void timer_real_alarm_handler(mcontext_t *mc) ...@@ -91,7 +92,7 @@ static void timer_real_alarm_handler(mcontext_t *mc)
{ {
struct uml_pt_regs *regs; struct uml_pt_regs *regs;
regs = malloc(sizeof(struct uml_pt_regs)); regs = uml_kmalloc(sizeof(struct uml_pt_regs), UM_GFP_ATOMIC);
if (!regs) if (!regs)
panic("out of memory"); panic("out of memory");
......
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