diff --git a/ipc/sem.c b/ipc/sem.c
index 9e70cd7a17da7e74e915ce7f4061aa99aea66b89..2570830e29fcc40c3308448a7a2c4db5353dfa47 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -2091,7 +2091,8 @@ void exit_sem(struct task_struct *tsk)
 			 * possibility where we exit while freeary() didn't
 			 * finish unlocking sem_undo_list.
 			 */
-			spin_unlock_wait(&ulp->lock);
+			spin_lock(&ulp->lock);
+			spin_unlock(&ulp->lock);
 			rcu_read_unlock();
 			break;
 		}