[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171009081747.GA23371@kroah.com>
Date: Mon, 9 Oct 2017 10:17:47 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Jia-Ju Bai <baijiaju1990@....com>
Cc: patrik.r.jakobsson@...il.com, airlied@...ux.ie,
bhelgaas@...gle.com, forest@...ttletooquiet.net, simon@...anor.nu,
scott@...heina.com, tvboxspy@...il.com, dan.a.cashman@...il.com,
golubev.mikhail@...il.com, devel@...verdev.osuosl.org,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org,
dri-devel@...ts.freedesktop.org
Subject: Re: [PATCH] pci: Fix a possible sleep-in-atomic bug in
pci_set_power_state
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
Powered by blists - more mailing lists