All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/posix/sem: Fix locking imbalances in cobalt_sem_open
       [not found] <E1VN5el-0002Ct-8K@xenomai.org>
@ 2013-09-21  8:31 ` Philippe Gerum
  2013-09-21  9:17   ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Gerum @ 2013-09-21  8:31 UTC (permalink / raw)
  To: xenomai; +Cc: Kiszka, Jan

On 09/20/2013 08:42 PM, git repository hosting wrote:
> Module: xenomai-jki
> Branch: for-forge
> Commit: 8775720ae828d1e1be076f91b93a3eeac1b7ed90
> URL:    http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=8775720ae828d1e1be076f91b93a3eeac1b7ed90
>
> Author: Jan Kiszka <jan.kiszka@siemens.com>
> 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.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>

This fix should be backported to 2.6.

> ---
>
>   kernel/cobalt/posix/sem.c |    4 ++--
>   1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/cobalt/posix/sem.c b/kernel/cobalt/posix/sem.c
> index 076f2d2..60906fd 100644
> --- a/kernel/cobalt/posix/sem.c
> +++ b/kernel/cobalt/posix/sem.c
> @@ -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
> Xenomai-git@xenomai.org
> http://www.xenomai.org/mailman/listinfo/xenomai-git
>


-- 
Philippe.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/posix/sem: Fix locking imbalances in cobalt_sem_open
  2013-09-21  8:31 ` [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/posix/sem: Fix locking imbalances in cobalt_sem_open Philippe Gerum
@ 2013-09-21  9:17   ` Jan Kiszka
  2013-09-21  9:56     ` Philippe Gerum
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2013-09-21  9:17 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

On 2013-09-21 10:31, Philippe Gerum wrote:
> On 09/20/2013 08:42 PM, git repository hosting wrote:
>> Module: xenomai-jki
>> Branch: for-forge
>> Commit: 8775720ae828d1e1be076f91b93a3eeac1b7ed90
>> URL:   
>> http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=8775720ae828d1e1be076f91b93a3eeac1b7ed90
>>
>>
>> Author: Jan Kiszka <jan.kiszka@siemens.com>
>> 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.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>
> 
> 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

> 
>> ---
>>
>>   kernel/cobalt/posix/sem.c |    4 ++--
>>   1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/cobalt/posix/sem.c b/kernel/cobalt/posix/sem.c
>> index 076f2d2..60906fd 100644
>> --- a/kernel/cobalt/posix/sem.c
>> +++ b/kernel/cobalt/posix/sem.c
>> @@ -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
>> Xenomai-git@xenomai.org
>> 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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/posix/sem: Fix locking imbalances in cobalt_sem_open
  2013-09-21  9:17   ` Jan Kiszka
@ 2013-09-21  9:56     ` Philippe Gerum
  2013-09-21 10:00       ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Philippe Gerum @ 2013-09-21  9:56 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai

On 09/21/2013 11:17 AM, Jan Kiszka wrote:
> On 2013-09-21 10:31, Philippe Gerum wrote:
>> On 09/20/2013 08:42 PM, git repository hosting wrote:
>>> Module: xenomai-jki
>>> Branch: for-forge
>>> Commit: 8775720ae828d1e1be076f91b93a3eeac1b7ed90
>>> URL:
>>> http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=8775720ae828d1e1be076f91b93a3eeac1b7ed90
>>>
>>>
>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
>>> 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.
>>>
>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>
>>
>> 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

>
> Jan
>
>>
>>> ---
>>>
>>>    kernel/cobalt/posix/sem.c |    4 ++--
>>>    1 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/kernel/cobalt/posix/sem.c b/kernel/cobalt/posix/sem.c
>>> index 076f2d2..60906fd 100644
>>> --- a/kernel/cobalt/posix/sem.c
>>> +++ b/kernel/cobalt/posix/sem.c
>>> @@ -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
>>> Xenomai-git@xenomai.org
>>> http://www.xenomai.org/mailman/listinfo/xenomai-git
>>>
>>
>>
>
>


-- 
Philippe.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/posix/sem: Fix locking imbalances in cobalt_sem_open
  2013-09-21  9:56     ` Philippe Gerum
@ 2013-09-21 10:00       ` Jan Kiszka
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2013-09-21 10:00 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

On 2013-09-21 11:56, Philippe Gerum wrote:
> On 09/21/2013 11:17 AM, Jan Kiszka wrote:
>> On 2013-09-21 10:31, Philippe Gerum wrote:
>>> On 09/20/2013 08:42 PM, git repository hosting wrote:
>>>> Module: xenomai-jki
>>>> Branch: for-forge
>>>> Commit: 8775720ae828d1e1be076f91b93a3eeac1b7ed90
>>>> URL:
>>>> http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=8775720ae828d1e1be076f91b93a3eeac1b7ed90
>>>>
>>>>
>>>>
>>>> Author: Jan Kiszka <jan.kiszka@siemens.com>
>>>> 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.
>>>>
>>>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>>>>
>>>
>>> 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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-21 10:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1VN5el-0002Ct-8K@xenomai.org>
2013-09-21  8:31 ` [Xenomai] [Xenomai-git] Jan Kiszka : cobalt/posix/sem: Fix locking imbalances in cobalt_sem_open Philippe Gerum
2013-09-21  9:17   ` Jan Kiszka
2013-09-21  9:56     ` Philippe Gerum
2013-09-21 10:00       ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.