[PATCH -next] ipc: use GFP_ATOMIC under spin lock
From: Wei Yongjun
Date: Mon Apr 27 2020 - 23:46:37 EST
The function ipc_id_alloc() is called from ipc_addid(), in which
a spin lock is held, so we should use GFP_ATOMIC instead.
Fixes: de5738d1c364 ("ipc: convert ipcs_idr to XArray")
Signed-off-by: Wei Yongjun <weiyongjun1@xxxxxxxxxx>
---
ipc/util.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ipc/util.c b/ipc/util.c
index 723dc4b05208..093b31993d39 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -241,7 +241,7 @@ static inline int ipc_id_alloc(struct ipc_ids *ids, struct kern_ipc_perm *new)
xas.xa_index;
xas_store(&xas, new);
xas_clear_mark(&xas, XA_FREE_MARK);
- } while (__xas_nomem(&xas, GFP_KERNEL));
+ } while (__xas_nomem(&xas, GFP_ATOMIC));
xas_unlock(&xas);
err = xas_error(&xas);
@@ -250,7 +250,7 @@ static inline int ipc_id_alloc(struct ipc_ids *ids, struct kern_ipc_perm *new)
new->id = get_restore_id(ids);
new->seq = ipcid_to_seqx(new->id);
idx = ipcid_to_idx(new->id);
- err = xa_insert(&ids->ipcs, idx, new, GFP_KERNEL);
+ err = xa_insert(&ids->ipcs, idx, new, GFP_ATOMIC);
if (err == -EBUSY)
err = -ENOSPC;
set_restore_id(ids, -1);