Skip to contentSkip to conversation

vt6655: A possible sleep-in-atomic bug in vt6655_suspend

BUG Jia-Ju Bai 2 participants 3 messages Oct 9, 2017 PCI

lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

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

#1 lore raw
Quoted 9 lines · Jia-Ju Bai

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

author
#2 lore raw

Okay, I will send a patch :)

Thanks,
Jia-Ju Bai

Quoted 15 lines · Greg KH
Quoted 9 lines · Jia-Ju Bai

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