VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   34 Branches   58 Tags
author: Minghao Chi <chi.minghao@zte.com.cn> 2022-02-03 20:49:33 -0800 committer: Greg Kroah-Hartman <gregkh@linuxfoundation.org> 2022-02-08 18:35:07 +0100 commit: 3b6b7cbe466da765b22b9a47628f69df62d24372 parent: 2e45c87df3899708f167efef75095f0e3458fd7a
Commit Summary:
ipc/sem: do not sleep with a spin lock held
Diffstat:
1 file changed, 2 insertions, 1 deletion
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;