Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1285436
| From | Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3.14 30/37] usblp: do not set TASK_INTERRUPTIBLE before lock |
| Date | 2015-12-07 15:40 +0100 |
| Message-ID | <qD57m-5M6-87@gated-at.bofh.it> (permalink) |
| References | <qD4XE-5GH-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
3.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby <jslaby@suse.cz>
commit 19cd80a214821f4b558560ebd76bfb2c38b4f3d8 upstream.
It is not permitted to set task state before lock. usblp_wwait sets
the state to TASK_INTERRUPTIBLE and calls mutex_lock_interruptible.
Upon return from that function, the state will be TASK_RUNNING again.
This is clearly a bug and a warning is generated with LOCKDEP too:
WARNING: CPU: 1 PID: 5109 at kernel/sched/core.c:7404 __might_sleep+0x7d/0x90()
do not call blocking ops when !TASK_RUNNING; state=1 set at [<ffffffffa0c588d0>] usblp_wwait+0xa0/0x310 [usblp]
Modules linked in: ...
CPU: 1 PID: 5109 Comm: captmon Tainted: G W 4.2.5-0.gef2823b-default #1
Hardware name: LENOVO 23252SG/23252SG, BIOS G2ET33WW (1.13 ) 07/24/2012
ffffffff81a4edce ffff880236ec7ba8 ffffffff81716651 0000000000000000
ffff880236ec7bf8 ffff880236ec7be8 ffffffff8106e146 0000000000000282
ffffffff81a50119 000000000000028b 0000000000000000 ffff8802dab7c508
Call Trace:
...
[<ffffffff8106e1c6>] warn_slowpath_fmt+0x46/0x50
[<ffffffff8109a8bd>] __might_sleep+0x7d/0x90
[<ffffffff8171b20f>] mutex_lock_interruptible_nested+0x2f/0x4b0
[<ffffffffa0c588fc>] usblp_wwait+0xcc/0x310 [usblp]
[<ffffffffa0c58bb2>] usblp_write+0x72/0x350 [usblp]
[<ffffffff8121ed98>] __vfs_write+0x28/0xf0
...
Commit 7f477358e2384c54b190cc3b6ce28277050a041b (usblp: Implement the
ENOSPC convention) moved the set prior locking. So move it back after
the lock.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Fixes: 7f477358e2 ("usblp: Implement the ENOSPC convention")
Acked-By: Pete Zaitcev <zaitcev@yahoo.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/usb/class/usblp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/usb/class/usblp.c
+++ b/drivers/usb/class/usblp.c
@@ -869,11 +869,11 @@ static int usblp_wwait(struct usblp *usb
add_wait_queue(&usblp->wwait, &waita);
for (;;) {
- set_current_state(TASK_INTERRUPTIBLE);
if (mutex_lock_interruptible(&usblp->mut)) {
rc = -EINTR;
break;
}
+ set_current_state(TASK_INTERRUPTIBLE);
rc = usblp_wtest(usblp, nonblock);
mutex_unlock(&usblp->mut);
if (rc <= 0)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 3.14 00/37] 3.14.58-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
[PATCH 3.14 24/37] staging: rtl8712: Add device ID for Sitecom WLA2100 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
[PATCH 3.14 03/37] ppp: fix pppoe_dev deletion condition in pppoe_release() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
[PATCH 3.14 21/37] mac80211: fix driver RSSI event calculations Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
[PATCH 3.14 18/37] x86/setup: Fix low identity map for >= 2GB kernel range Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
[PATCH 3.14 35/37] ALSA: usb-audio: add packet size quirk for the Medeli DD305 Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
[PATCH 3.14 20/37] x86/cpu: Fix SMAP check in PVOPS environments Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
[PATCH 3.14 25/37] Bluetooth: hidp: fix device disconnect on idle timeout Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
[PATCH 3.14 07/37] ipmr: fix possible race resulting from improper usage of IP_INC_STATS_BH() in preemptible context. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
[PATCH 3.14 23/37] mwifiex: fix mwifiex_rdeeprom_read() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:30 +0100
[PATCH 3.14 26/37] Bluetooth: ath3k: Add new AR3012 0930:021c id Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 14/37] ARM: 8427/1: dma-mapping: add support for offset parameter in dma_mmap() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 16/37] ARM: common: edma: Fix channel parameter for irq callbacks Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 37/37] ALSA: usb-audio: work around CH345 input SysEx corruption Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 28/37] can: sja1000: clear interrupts on start Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 04/37] RDS-TCP: Recover correctly from pskb_pull()/pksb_trim() failure in rds_tcp_data_recv Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 09/37] packet: race condition in packet_bind Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 02/37] macvtap: unbreak receiving of gro skb with frag list Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 17/37] x86/setup: Extend low identity map to cover whole kernel range Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 27/37] Bluetooth: ath3k: Add support of AR3012 0cf3:817b device Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 36/37] ALSA: usb-audio: prevent CH345 multiport output SysEx corruption Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 06/37] stmmac: Correctly report PTP capabilities. Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 13/37] ARM: 8426/1: dma-mapping: add missing range check in dma_mmap() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 08/37] net: avoid NULL deref in inet_ctl_sock_destroy() Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 29/37] arm64: Fix compat register mappings Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 05/37] net/mlx4: Copy/set only sizeof struct mlx4_eqe bytes Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 30/37] usblp: do not set TASK_INTERRUPTIBLE before lock Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 15:40 +0100
[PATCH 3.14 12/37] RDS: verify the underlying transport exists before creating a connection Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 17:30 +0100
[PATCH 3.14 11/37] virtio-net: drop NETIF_F_FRAGLIST Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-07 17:30 +0100
Re: [PATCH 3.14 00/37] 3.14.58-stable review Shuah Khan <shuahkh@osg.samsung.com> - 2015-12-07 18:20 +0100
Re: [PATCH 3.14 00/37] 3.14.58-stable review Guenter Roeck <linux@roeck-us.net> - 2015-12-07 22:20 +0100
Re: [PATCH 3.14 00/37] 3.14.58-stable review Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2015-12-09 04:30 +0100
csiph-web