From: Greg KH <gregkh@linuxfoundation.org>
To: Jia-Ju Bai <baijiaju1990@163.com>
Cc: patrik.r.jakobsson@gmail.com, airlied@linux.ie,
bhelgaas@google.com, forest@alittletooquiet.net,
simon@nikanor.nu, scott@matheina.com, tvboxspy@gmail.com,
dan.a.cashman@gmail.com, golubev.mikhail@gmail.com,
devel@driverdev.osuosl.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] pci: Fix a possible sleep-in-atomic bug in pci_set_power_state
Date: Mon, 9 Oct 2017 10:17:47 +0200 [thread overview]
Message-ID: <20171009081747.GA23371@kroah.com> (raw)
In-Reply-To: <1507536980-9345-1-git-send-email-baijiaju1990@163.com>
On Mon, Oct 09, 2017 at 04:16:20PM +0800, Jia-Ju Bai wrote:
> The drivers vt6655 and gma500 call pci_set_power_state under a spinlock, which may sleep.
> The function call paths are:
> gma_power_begin (acquire the spinlock) (drivers/gpu/drm/gma500/power.c)
> gma_resume_pci
> pci_set_power_state
> __pci_start_power_transition (drivers/pci/pci.c)
> msleep --> may sleep
>
> gma_power_begin (acquire the spinlock) (drivers/gpu/drm/gma500/power.c)
> gma_resume_pci
> pci_enable_device
> pci_enable_device_flags (drivers/pci/pci.c)
> do_pci_enable_device
> pci_set_power_state
> __pci_start_power_transition
> msleep --> may sleep
>
> vt6655_suspend (acquire the spinlock) (drivers/staging/vt6655/device_main.c)
> pci_set_power_state
> __pci_start_power_transition (drivers/pci/pci.c)
> msleep --> may sleep
>
> To fix these bugs, msleep is replaced with mdelay in __pci_start_power_transition
>
> These bugs are found by my static analysis tool and my code review.
Wait, no, why not fix the callers to not have a spinlock. Those are the
only users of these calls that are doing so incorrectly, don't change
the PCI core for the fault of 2 broken drivers.
thanks,
greg k-h
next prev parent reply other threads:[~2017-10-09 8:17 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-09 8:16 [PATCH] pci: Fix a possible sleep-in-atomic bug in pci_set_power_state Jia-Ju Bai
2017-10-09 8:17 ` Greg KH [this message]
2017-10-09 8:32 ` Jia-Ju Bai
2017-10-09 17:15 ` Bjorn Helgaas
2017-10-09 17:18 ` Bjorn Helgaas
2017-10-09 18:21 ` Rafael J. Wysocki
2017-10-11 13:33 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171009081747.GA23371@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=airlied@linux.ie \
--cc=baijiaju1990@163.com \
--cc=bhelgaas@google.com \
--cc=dan.a.cashman@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=forest@alittletooquiet.net \
--cc=golubev.mikhail@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=patrik.r.jakobsson@gmail.com \
--cc=scott@matheina.com \
--cc=simon@nikanor.nu \
--cc=tvboxspy@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox