ipc/msg.c | 2 +- ipc/sem.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ipc/msg.c b/ipc/msg.c index 31cd1bf6af27..338d8e2b589b 100644 --- a/ipc/msg.c +++ b/ipc/msg.c @@ -284,7 +284,6 @@ static void freeque(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp) expunge_all(msq, -EIDRM); ss_wakeup(&msq->q_senders, 1); msg_rmid(ns, msq); - msg_unlock(msq); tmp = msq->q_messages.next; while (tmp != &msq->q_messages) { @@ -297,6 +296,7 @@ static void freeque(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp) atomic_sub(msq->q_cbytes, &ns->msg_bytes); security_msg_queue_free(msq); ipc_rcu_putref(msq); + msg_unlock(msq); } /* diff --git a/ipc/sem.c b/ipc/sem.c index 58d31f1c1eb5..1cf024b9eac0 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -766,12 +766,12 @@ static void freeary(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp) /* Remove the semaphore set from the IDR */ sem_rmid(ns, sma); - sem_unlock(sma); wake_up_sem_queue_do(&tasks); ns->used_sems -= sma->sem_nsems; security_sem_free(sma); ipc_rcu_putref(sma); + sem_unlock(sma); } static unsigned long copy_semid_to_user(void __user *buf, struct semid64_ds *in, int version)