sgi-xpc: Use GFP_ATOMIC for kmalloc in atomic context.
authorFuqian Huang <huangfq.daxian@gmail.com>
Mon, 5 Aug 2019 12:56:25 +0000 (20:56 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Aug 2019 16:20:32 +0000 (18:20 +0200)
xpc_send_activate_IRQ_uv is called from
 <-xpc_send_activate_IRQ_part_uv
 <-xpc_indicate_partition_disengaged_uv
  (xpc_arch_ops.indicate_partition_disengaged)
 <-xpc_die_deactivate
 <-xpc_system_die

xpc_system_die is registered by atomic_notifier_chain_register,
which indicates xpc_system_die may be called in atomic context.
So the kmalloc in xpc_send_activate_IRQ_uv may be in atomic context.

Use GFP_ATOMIC instead of GFP_KERNEL in kmalloc.

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Link: https://lore.kernel.org/r/20190805125625.24963-1-huangfq.daxian@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/sgi-xp/xpc_uv.c

index 89c4b04..7f34b97 100644 (file)
@@ -694,7 +694,7 @@ again:
                if (gru_mq_desc == NULL) {
                        gru_mq_desc = kmalloc(sizeof(struct
                                              gru_message_queue_desc),
-                                             GFP_KERNEL);
+                                             GFP_ATOMIC);
                        if (gru_mq_desc == NULL) {
                                ret = xpNoMemory;
                                goto done;