[PATCH 7/7 part3] fix for sem_lock

From: Rik van Riel
Date: Fri Mar 22 2013 - 19:42:59 EST



> > + /*
> > + * If sma->complex_count was set while we were spinning,
> > + * we may need to look at things we did not lock here.
> > + */
> > + if (unlikely(sma->complex_count)) {
> > + spin_unlock(&sma->sem_perm.lock);
>
> I believe this should be spin_unlock(&sem->lock) instead ?

Michel, thanks for spotting this!

Andrew, could you fold this fix into my patch 7/7 before submitting
things for 3.10? Thank you.

--->8---
Fix a typo in sem_lock. Of course we need to unlock the local
semaphore lock before jumping to lock_all, in the rare case that
somebody started a complex operation while we were spinning on
the spinlock.

Can be folded into patch 7/7 before merging

Signed-off-by: Rik van Riel <riel@xxxxxxxxxx>
Reported-by: Michel Lespinasse <walken@xxxxxxxxxx>
---
ipc/sem.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/ipc/sem.c b/ipc/sem.c
index a4b93fb..450248e 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -346,7 +346,7 @@ static inline int sem_lock(struct sem_array *sma, struct sembuf *sops,
* we may need to look at things we did not lock here.
*/
if (unlikely(sma->complex_count)) {
- spin_unlock(&sma->sem_perm.lock);
+ spin_unlock(&sem->lock);
goto lock_all;
}
locknum = sops->sem_num;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/