On 03/31/2013 01:01 AM, Davidlohr Bueso wrote:

diff --git a/ipc/sem.c b/ipc/sem.c
index f257afe..74cedfe 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -1867,8 +1867,7 @@ void exit_sem(struct task_struct *tsk)
                struct sem_array *sma;
                struct sem_undo *un;
                struct list_head tasks;
-               int semid;
-               int i;
+               int semid, i;

                rcu_read_lock();
                un = list_entry_rcu(ulp->list_proc.next,
@@ -1884,12 +1883,13 @@ void exit_sem(struct task_struct *tsk)
                }

                sma = sem_obtain_object_check(tsk->nsproxy->ipc_ns, un->semid);

Should we use "semid" here, like Linus suggested, instead of "un->semid"?

-               sem_lock(sma, NULL, -1);
-
                /* exit_sem raced with IPC_RMID, nothing to do */
-               if (IS_ERR(sma))
+               if (IS_ERR(sma)) {
+                       rcu_read_unlock();
                        continue;
+               }

+               sem_lock(sma, NULL, -1);
                un = __lookup_undo(ulp, semid);
                if (un == NULL) {
                        /* exit_sem raced with IPC_RMID+semget() that created


--
All rights reversed.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to