From: Jia-Ju Bai <baijiaju1990@163.com>
To: forest@alittletooquiet.net, gregkh@linuxfoundation.org,
simon@nikanor.nu, tvboxspy@gmail.com, scott@matheina.com,
dan.a.cashman@gmail.com, golubev.mikhail@gmail.com
Cc: devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org, Jia-Ju Bai <baijiaju1990@163.com>
Subject: [PATCH] vt6655: Fix a possible sleep-in-atomic bug in vt6655_suspend
Date: Mon, 9 Oct 2017 16:45:55 +0800 [thread overview]
Message-ID: <1507538755-10217-1-git-send-email-baijiaju1990@163.com> (raw)
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 <baijiaju1990@163.com>
---
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 9fcf2e2..1123b4f 100644
--- a/drivers/staging/vt6655/device_main.c
+++ b/drivers/staging/vt6655/device_main.c
@@ -1693,10 +1693,11 @@ static int vt6655_suspend(struct pci_dev *pcid, pm_message_t state)
MACbShutdown(priv);
pci_disable_device(pcid);
- pci_set_power_state(pcid, pci_choose_state(pcid, state));
spin_unlock_irqrestore(&priv->lock, flags);
+ pci_set_power_state(pcid, pci_choose_state(pcid, state));
+
return 0;
}
--
1.7.9.5
reply other threads:[~2017-10-09 8:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1507538755-10217-1-git-send-email-baijiaju1990@163.com \
--to=baijiaju1990@163.com \
--cc=dan.a.cashman@gmail.com \
--cc=devel@driverdev.osuosl.org \
--cc=forest@alittletooquiet.net \
--cc=golubev.mikhail@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.