All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ipc/sem: do not sleep with a spin lock held
@ 2021-12-22  8:10 cgel.zte
  2021-12-22 11:45 ` Manfred Spraul
  0 siblings, 1 reply; 15+ messages in thread
From: cgel.zte @ 2021-12-22  8:10 UTC (permalink / raw)
  To: akpm
  Cc: vvs, shakeelb, rdunlap, dbueso, unixbhaskar, manfred,
	chi.minghao, arnd, linux-kernel, Zeal Robot

From: Minghao Chi <chi.minghao@zte.com.cn>

We can't call kvfree() with a spin lock held, so defer it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 ipc/sem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ipc/sem.c b/ipc/sem.c
index 6693daf4fe11..0dbdb98fdf2d 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1964,6 +1964,7 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid)
 	 */
 	un = lookup_undo(ulp, semid);
 	if (un) {
+		spin_unlock(&ulp->lock);
 		kvfree(new);
 		goto success;
 	}
@@ -1976,9 +1977,8 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid)
 	ipc_assert_locked_object(&sma->sem_perm);
 	list_add(&new->list_id, &sma->list_id);
 	un = new;
-
-success:
 	spin_unlock(&ulp->lock);
+success:
 	sem_unlock(sma, -1);
 out:
 	return un;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-01-04 20:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-22  8:10 [PATCH] ipc/sem: do not sleep with a spin lock held cgel.zte
2021-12-22 11:45 ` Manfred Spraul
2021-12-22 15:31   ` Vasily Averin
2021-12-22 15:50     ` Vasily Averin
2021-12-22 17:06       ` Manfred Spraul
2021-12-22 17:38         ` Vasily Averin
2021-12-22 19:08           ` Vasily Averin
2021-12-23  2:37   ` [PATCH v2] " cgel.zte
2021-12-23  2:56   ` cgel.zte
2021-12-23  3:12   ` cgel.zte
2022-01-03  9:27     ` Jiri Slaby
2022-01-03 17:17       ` Manfred Spraul
2022-01-04 18:20         ` Shakeel Butt
2022-01-04 18:20     ` Shakeel Butt
2022-01-04 20:18       ` Manfred Spraul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.