Return-Path: Received: from mail-by2nam03on0137.outbound.protection.outlook.com ([104.47.42.137]:8724 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755045AbeARVHW (ORCPT ); Thu, 18 Jan 2018 16:07:22 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Jia-Ju Bai , Greg Kroah-Hartman , Sasha Levin Subject: [added to the 4.1 stable tree] vt6655: Fix a possible sleep-in-atomic bug in vt6655_suspend Date: Thu, 18 Jan 2018 21:01:56 +0000 Message-ID: <20180118205908.3220-283-alexander.levin@microsoft.com> References: <20180118205908.3220-1-alexander.levin@microsoft.com> In-Reply-To: <20180118205908.3220-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Jia-Ju Bai This patch has been added to the stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit 42c8eb3f6e15367981b274cb79ee4657e2c6949d ] 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 To fix it, pci_set_power_state is called without having a spinlock. This bug is found by my static analysis tool and my code review. Signed-off-by: Jia-Ju Bai Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/vt6655/device_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/= device_main.c index 376e4a0c15c6..8f1844f0547e 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c @@ -1838,10 +1838,11 @@ static int vt6655_suspend(struct pci_dev *pcid, pm_= message_t state) MACbShutdown(priv->PortOffset); =20 pci_disable_device(pcid); - pci_set_power_state(pcid, pci_choose_state(pcid, state)); =20 spin_unlock_irqrestore(&priv->lock, flags); =20 + pci_set_power_state(pcid, pci_choose_state(pcid, state)); + return 0; } =20 --=20 2.11.0