Commit a9795584 authored by Herton R. Krzesinski's avatar Herton R. Krzesinski Committed by Linus Torvalds

ipc,sem: remove uneeded sem_undo_list lock usage in exit_sem()

After we acquire the sma->sem_perm lock in exit_sem(), we are protected
against a racing IPC_RMID operation.  Also at that point, we are the last
user of sem_undo_list.  Therefore it isn't required that we acquire or use
ulp->lock.
Signed-off-by: default avatarHerton R. Krzesinski <herton@redhat.com>
Acked-by: default avatarManfred Spraul <manfred@colorfullife.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Rafael Aquini <aquini@redhat.com>
CC: Aristeu Rozanski <aris@redhat.com>
Cc: David Jeffery <djeffery@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 602b8593
...@@ -2123,9 +2123,11 @@ void exit_sem(struct task_struct *tsk) ...@@ -2123,9 +2123,11 @@ void exit_sem(struct task_struct *tsk)
ipc_assert_locked_object(&sma->sem_perm); ipc_assert_locked_object(&sma->sem_perm);
list_del(&un->list_id); list_del(&un->list_id);
spin_lock(&ulp->lock); /* we are the last process using this ulp, acquiring ulp->lock
* isn't required. Besides that, we are also protected against
* IPC_RMID as we hold sma->sem_perm lock now
*/
list_del_rcu(&un->list_proc); list_del_rcu(&un->list_proc);
spin_unlock(&ulp->lock);
/* perform adjustments registered in un */ /* perform adjustments registered in un */
for (i = 0; i < sma->sem_nsems; i++) { for (i = 0; i < sma->sem_nsems; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment