diff options
| -rw-r--r-- | kernel/posix-timers.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c index 7185f05d53a9..95451bf7d2eb 100644 --- a/kernel/posix-timers.c +++ b/kernel/posix-timers.c | |||
| @@ -556,7 +556,7 @@ out: | |||
| 556 | * the find to the timer lock. To avoid a dead lock, the timer id MUST | 556 | * the find to the timer lock. To avoid a dead lock, the timer id MUST |
| 557 | * be release with out holding the timer lock. | 557 | * be release with out holding the timer lock. |
| 558 | */ | 558 | */ |
| 559 | static struct k_itimer * lock_timer(timer_t timer_id, unsigned long *flags) | 559 | static struct k_itimer *lock_timer(timer_t timer_id, unsigned long *flags) |
| 560 | { | 560 | { |
| 561 | struct k_itimer *timr; | 561 | struct k_itimer *timr; |
| 562 | /* | 562 | /* |
| @@ -564,23 +564,20 @@ static struct k_itimer * lock_timer(timer_t timer_id, unsigned long *flags) | |||
| 564 | * flags part over to the timer lock. Must not let interrupts in | 564 | * flags part over to the timer lock. Must not let interrupts in |
| 565 | * while we are moving the lock. | 565 | * while we are moving the lock. |
| 566 | */ | 566 | */ |
| 567 | |||
| 568 | spin_lock_irqsave(&idr_lock, *flags); | 567 | spin_lock_irqsave(&idr_lock, *flags); |
| 569 | timr = idr_find(&posix_timers_id, (int) timer_id); | 568 | timr = idr_find(&posix_timers_id, (int)timer_id); |
| 570 | if (timr) { | 569 | if (timr) { |
| 571 | spin_lock(&timr->it_lock); | 570 | spin_lock(&timr->it_lock); |
| 572 | 571 | if (timr->it_process && | |
| 573 | if (!timr->it_process || | 572 | same_thread_group(timr->it_process, current)) { |
| 574 | !same_thread_group(timr->it_process, current)) { | ||
| 575 | spin_unlock(&timr->it_lock); | ||
| 576 | spin_unlock_irqrestore(&idr_lock, *flags); | ||
| 577 | timr = NULL; | ||
| 578 | } else | ||
| 579 | spin_unlock(&idr_lock); | 573 | spin_unlock(&idr_lock); |
| 580 | } else | 574 | return timr; |
| 581 | spin_unlock_irqrestore(&idr_lock, *flags); | 575 | } |
| 576 | spin_unlock(&timr->it_lock); | ||
| 577 | } | ||
| 578 | spin_unlock_irqrestore(&idr_lock, *flags); | ||
| 582 | 579 | ||
| 583 | return timr; | 580 | return NULL; |
| 584 | } | 581 | } |
| 585 | 582 | ||
| 586 | /* | 583 | /* |
