All of lore.kernel.org
 help / color / mirror / Atom feed
* BUG? a suspected race bug at sdio_irq_thread()
       [not found] <2014bcab0909022048n2c937af4l5bd38c501469b1c7@mail.gmail.com>
@ 2009-09-07 10:15 ` 홍신 shin hong
  2009-09-08  2:30   ` Nicolas Pitre
  0 siblings, 1 reply; 2+ messages in thread
From: 홍신 shin hong @ 2009-09-07 10:15 UTC (permalink / raw)
  To: linux-mmc

Hello. I am reporting a suspected race bug at sdio_irq_thread()
in drivers/mmc/core/sdio_irq.c of Linux 2.6.30.5.

I hope this report is helpful. I am not certain whether this reports
real bug or not since I do not have much background.
So, please examine the report and let me know your opinion.

sdio_irq_therad() is spawned as a sdio_card_irq_get().
This thread is stopped by sdio_card_irq_put().

sdio_irq_thread() finishes its do-while iteration
when kthread_should_stop() returns true
or a condition is satisfied (break statements at line 106)

For the later case, if sdio_irq_thread() is finished
before kthread_should_stop() returns false.

In that situation, if other thread invokes kthread_stop(),
the caller of kthread_stop() might have a problem (waiting indefinitely).

Could you examine the possibility of this type of errors please?

Thank you

Sincerely
Shin Hong

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

* Re: BUG? a suspected race bug at sdio_irq_thread()
  2009-09-07 10:15 ` BUG? a suspected race bug at sdio_irq_thread() 홍신 shin hong
@ 2009-09-08  2:30   ` Nicolas Pitre
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Pitre @ 2009-09-08  2:30 UTC (permalink / raw)
  To: 홍신 shin hong; +Cc: linux-mmc

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1113 bytes --]

On Mon, 7 Sep 2009, 홍신 shin hong wrote:

> sdio_irq_therad() is spawned as a sdio_card_irq_get().
> This thread is stopped by sdio_card_irq_put().
> 
> sdio_irq_thread() finishes its do-while iteration
> when kthread_should_stop() returns true
> or a condition is satisfied (break statements at line 106)
> 
> For the later case, if sdio_irq_thread() is finished
> before kthread_should_stop() returns false.
> 
> In that situation, if other thread invokes kthread_stop(),
> the caller of kthread_stop() might have a problem (waiting indefinitely).

No.

First of all, you get one instance of sdio_irq_thread() for each card.  
And if a card has multiple functions, then multiple sdio_card_irq_get() 
and sdio_card_irq_put() are expected, and they should be balanced as 
well.

So, when the last user of SDIO card interrupt calls sdio_card_irq_put(), 
then kthread_stop() is called on the IRQ thread, meaning that the 
kthread_should_stop condition is made true and the thread awakened, and 
then its termination is waited for.  If the thread terminated itself 
then there is simply no waiting to do.


Nicolas

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

end of thread, other threads:[~2009-09-08  2:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2014bcab0909022048n2c937af4l5bd38c501469b1c7@mail.gmail.com>
2009-09-07 10:15 ` BUG? a suspected race bug at sdio_irq_thread() 홍신 shin hong
2009-09-08  2:30   ` Nicolas Pitre

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.