Skip to contentSkip to conversation

Jan Kiszka : cobalt/posix/sem: Fix locking imbalances in cobalt_sem_open

Xenomai Philippe Gerum 2 participants 4 messages Sep 21, 2013 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 5 lines · git repository hosting
Module: xenomai-jki
Branch: for-forge
Commit: 8775720ae828d1e1be076f91b93a3eeac1b7ed90
URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=8775720ae828d1e1be076f91b93a3eeac1b7ed90
Quoted 9 lines
Author: Jan Kiszka <[email protected]>
Date:   Fri Sep 20 20:39:18 2013 +0200

cobalt/posix/sem: Fix locking imbalances in cobalt_sem_open

We hold cobalt_assoc_lock, not nklock.

This fix should be backported to 2.6.

Quoted 34 lines

---

  kernel/cobalt/posix/sem.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
kernel/cobalt/posix/sem.c +2 -2
index 076f2d2..60906fd 100644
@@ -916,7 +916,7 @@ int cobalt_sem_open(unsigned long __user *u_addr,
  	if (assoc) {
  		usm = container_of(assoc, struct cobalt_usem, assoc);
  		++usm->refcnt;
-		xnlock_put_irqrestore(&nklock, s);
+		xnlock_put_irqrestore(&cobalt_assoc_lock, s);
  		goto got_usm;
  	}
 
@@ -936,7 +936,7 @@ int cobalt_sem_open(unsigned long __user *u_addr,
  	assoc = cobalt_assoc_lookup(&cc->usems, (u_long)sm->sem);
  	if (assoc) {
  		container_of(assoc, struct cobalt_usem, assoc)->refcnt++;
-		xnlock_put_irqrestore(&nklock, s);
+		xnlock_put_irqrestore(&cobalt_assoc_lock, s);
  		xnfree(usm);
  		usm = container_of(assoc, struct cobalt_usem, assoc);
  		goto got_usm;

_______________________________________________
Xenomai-git mailing list
[email protected]
http://www.xenomai.org/mailman/listinfo/xenomai-git

Signature · 1 line
Philippe.
#2 lore raw
Quoted 11 lines · Philippe Gerum
Quoted 10 lines · git repository hosting

Module: xenomai-jki
Branch: for-forge
Commit: 8775720ae828d1e1be076f91b93a3eeac1b7ed90
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=8775720ae828d1e1be076f91b93a3eeac1b7ed90

Author: Jan Kiszka <[email protected]>
Date:   Fri Sep 20 20:39:18 2013 +0200
Quoted 8 lines
Quoted 6 lines

cobalt/posix/sem: Fix locking imbalances in cobalt_sem_open

We hold cobalt_assoc_lock, not nklock.

This fix should be backported to 2.6.

I don't find this pattern in 2.6. There we seem to use only nklock.

Jan

Quoted 30 lines
Quoted 30 lines

---

  kernel/cobalt/posix/sem.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)
kernel/cobalt/posix/sem.c +2 -2
index 076f2d2..60906fd 100644
@@ -916,7 +916,7 @@ int cobalt_sem_open(unsigned long __user *u_addr,
      if (assoc) {
          usm = container_of(assoc, struct cobalt_usem, assoc);
          ++usm->refcnt;
-        xnlock_put_irqrestore(&nklock, s);
+        xnlock_put_irqrestore(&cobalt_assoc_lock, s);
          goto got_usm;
      }
 
@@ -936,7 +936,7 @@ int cobalt_sem_open(unsigned long __user *u_addr,
      assoc = cobalt_assoc_lookup(&cc->usems, (u_long)sm->sem);
      if (assoc) {
          container_of(assoc, struct cobalt_usem, assoc)->refcnt++;
-        xnlock_put_irqrestore(&nklock, s);
+        xnlock_put_irqrestore(&cobalt_assoc_lock, s);
          xnfree(usm);
          usm = container_of(assoc, struct cobalt_usem, assoc);
          goto got_usm;
Quoted 7 lines
Quoted 5 lines

_______________________________________________
Xenomai-git mailing list
[email protected]
http://www.xenomai.org/mailman/listinfo/xenomai-git

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20130921/bac4704f/attachment.pgp>

#3 lore raw
Quoted 14 lines · Jan Kiszka
Quoted 13 lines · Philippe Gerum
Quoted 12 lines · git repository hosting

Module: xenomai-jki
Branch: for-forge
Commit: 8775720ae828d1e1be076f91b93a3eeac1b7ed90
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=8775720ae828d1e1be076f91b93a3eeac1b7ed90

Author: Jan Kiszka <[email protected]>
Date:   Fri Sep 20 20:39:18 2013 +0200

cobalt/posix/sem: Fix locking imbalances in cobalt_sem_open

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

We hold cobalt_assoc_lock, not nklock.

This fix should be backported to 2.6.

I don't find this pattern in 2.6. There we seem to use only nklock.

The relevant code for 2.6 is in __sem_open(), ksrc/skins/posix/syscall.c

Quoted 42 lines

Jan

Quoted 37 lines
Quoted 35 lines

---

   kernel/cobalt/posix/sem.c |    4 ++--
   1 files changed, 2 insertions(+), 2 deletions(-)
kernel/cobalt/posix/sem.c +2 -2
index 076f2d2..60906fd 100644
@@ -916,7 +916,7 @@ int cobalt_sem_open(unsigned long __user *u_addr,
       if (assoc) {
           usm = container_of(assoc, struct cobalt_usem, assoc);
           ++usm->refcnt;
-        xnlock_put_irqrestore(&nklock, s);
+        xnlock_put_irqrestore(&cobalt_assoc_lock, s);
           goto got_usm;
       }
 
@@ -936,7 +936,7 @@ int cobalt_sem_open(unsigned long __user *u_addr,
       assoc = cobalt_assoc_lookup(&cc->usems, (u_long)sm->sem);
       if (assoc) {
           container_of(assoc, struct cobalt_usem, assoc)->refcnt++;
-        xnlock_put_irqrestore(&nklock, s);
+        xnlock_put_irqrestore(&cobalt_assoc_lock, s);
           xnfree(usm);
           usm = container_of(assoc, struct cobalt_usem, assoc);
           goto got_usm;

_______________________________________________
Xenomai-git mailing list
[email protected]
http://www.xenomai.org/mailman/listinfo/xenomai-git

Signature · 1 line
Philippe.
#4 lore raw
Quoted 18 lines · Philippe Gerum
Quoted 17 lines · Jan Kiszka
Quoted 16 lines · Philippe Gerum
Quoted 15 lines · git repository hosting

Module: xenomai-jki
Branch: for-forge
Commit: 8775720ae828d1e1be076f91b93a3eeac1b7ed90
URL:
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=8775720ae828d1e1be076f91b93a3eeac1b7ed90

Author: Jan Kiszka <[email protected]>
Date:   Fri Sep 20 20:39:18 2013 +0200

cobalt/posix/sem: Fix locking imbalances in cobalt_sem_open

We hold cobalt_assoc_lock, not nklock.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

This fix should be backported to 2.6.

I don't find this pattern in 2.6. There we seem to use only nklock.

The relevant code for 2.6 is in __sem_open(), ksrc/skins/posix/syscall.c

Ah! Pushed a patch.

Jan

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 263 bytes
Desc: OpenPGP digital signature
URL: <http://www.xenomai.org/pipermail/xenomai/attachments/20130921/dd600403/attachment.pgp>