Skip to content

Commit 520ba72

Browse files
Minghao Chitorvalds
authored andcommitted
ipc/sem: do not sleep with a spin lock held
We can't call kvfree() with a spin lock held, so defer it. Link: https://lkml.kernel.org/r/[email protected] Fixes: fc37a3b ("[PATCH] ipc sem: use kvmalloc for sem_undo allocation") Reported-by: Zeal Robot <[email protected]> Signed-off-by: Minghao Chi <[email protected]> Reviewed-by: Shakeel Butt <[email protected]> Reviewed-by: Manfred Spraul <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: Yang Guang <[email protected]> Cc: Davidlohr Bueso <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: Bhaskar Chowdhury <[email protected]> Cc: Vasily Averin <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 314c459 commit 520ba72

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ipc/sem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1964,6 +1964,7 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid)
19641964
*/
19651965
un = lookup_undo(ulp, semid);
19661966
if (un) {
1967+
spin_unlock(&ulp->lock);
19671968
kvfree(new);
19681969
goto success;
19691970
}
@@ -1976,9 +1977,8 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid)
19761977
ipc_assert_locked_object(&sma->sem_perm);
19771978
list_add(&new->list_id, &sma->list_id);
19781979
un = new;
1979-
1980-
success:
19811980
spin_unlock(&ulp->lock);
1981+
success:
19821982
sem_unlock(sma, -1);
19831983
out:
19841984
return un;

0 commit comments

Comments
 (0)