2019-08-05 12:57:25

by Fuqian Huang

[permalink] [raw]
Subject: [PATCH] sgi-xpc: Use GFP_ATOMIC for kmalloc in atomic context.

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 <[email protected]>
---
drivers/misc/sgi-xp/xpc_uv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
index 0c6de97dd347..422341e3234b 100644
--- a/drivers/misc/sgi-xp/xpc_uv.c
+++ b/drivers/misc/sgi-xp/xpc_uv.c
@@ -694,7 +694,7 @@ xpc_send_activate_IRQ_uv(struct xpc_partition *part, void *msg, size_t msg_size,
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;
--
2.11.0