public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [BUG] vt6655: A possible sleep-in-atomic bug in vt6655_suspend
@ 2017-10-09  1:10 Jia-Ju Bai
  2017-10-09  5:43 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Jia-Ju Bai @ 2017-10-09  1:10 UTC (permalink / raw)
  To: forest, gregkh, simon, tvboxspy, scott, dan.a.cashman,
	golubev.mikhail, bhelgaas
  Cc: devel, Linux Kernel Mailing List, linux-pci

According to device_main.c, the driver may sleep under a spinlock,
and the function call path is:
vt6655_suspend (acquire the spinlock)
   pci_set_power_state
     __pci_start_power_transition (drivers/pci/pci.c)
       msleep --> may sleep

A possible fix is to replace msleep with mdelay in 
__pci_start_power_transition in drivers/pci/pci.c.

This bug is found by my static analysis tool and my code review.


Thanks,
Jia-Ju Bai

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

* Re: [BUG] vt6655: A possible sleep-in-atomic bug in vt6655_suspend
  2017-10-09  1:10 [BUG] vt6655: A possible sleep-in-atomic bug in vt6655_suspend Jia-Ju Bai
@ 2017-10-09  5:43 ` Greg KH
  2017-10-09  7:56   ` Jia-Ju Bai
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2017-10-09  5:43 UTC (permalink / raw)
  To: Jia-Ju Bai
  Cc: forest, simon, tvboxspy, scott, dan.a.cashman, golubev.mikhail,
	bhelgaas, devel, Linux Kernel Mailing List, linux-pci

On Mon, Oct 09, 2017 at 09:10:28AM +0800, Jia-Ju Bai wrote:
> According to device_main.c, the driver may sleep under a spinlock,
> and the function call path is:
> vt6655_suspend (acquire the spinlock)
>   pci_set_power_state
>     __pci_start_power_transition (drivers/pci/pci.c)
>       msleep --> may sleep
> 
> A possible fix is to replace msleep with mdelay in
> __pci_start_power_transition in drivers/pci/pci.c.

Patches are usually best to send in for things that you find like this.

thanks,

greg k-h

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

* Re: [BUG] vt6655: A possible sleep-in-atomic bug in vt6655_suspend
  2017-10-09  5:43 ` Greg KH
@ 2017-10-09  7:56   ` Jia-Ju Bai
  0 siblings, 0 replies; 3+ messages in thread
From: Jia-Ju Bai @ 2017-10-09  7:56 UTC (permalink / raw)
  To: Greg KH
  Cc: forest, simon, tvboxspy, scott, dan.a.cashman, golubev.mikhail,
	bhelgaas, devel, Linux Kernel Mailing List, linux-pci

Okay, I will send a patch :)


Thanks,
Jia-Ju Bai

On 2017/10/9 13:43, Greg KH wrote:
> On Mon, Oct 09, 2017 at 09:10:28AM +0800, Jia-Ju Bai wrote:
>> According to device_main.c, the driver may sleep under a spinlock,
>> and the function call path is:
>> vt6655_suspend (acquire the spinlock)
>>    pci_set_power_state
>>      __pci_start_power_transition (drivers/pci/pci.c)
>>        msleep --> may sleep
>>
>> A possible fix is to replace msleep with mdelay in
>> __pci_start_power_transition in drivers/pci/pci.c.
> Patches are usually best to send in for things that you find like this.
>
> thanks,
>
> greg k-h

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

end of thread, other threads:[~2017-10-09  7:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-09  1:10 [BUG] vt6655: A possible sleep-in-atomic bug in vt6655_suspend Jia-Ju Bai
2017-10-09  5:43 ` Greg KH
2017-10-09  7:56   ` Jia-Ju Bai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox