aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMalcolm Priestley <tvboxspy@gmail.com>2013-01-30 15:07:29 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-01-31 04:30:45 -0500
commitae5943de8c8c4438cbac5cda599ff0b88c224468 (patch)
treec5ccd9d89df4e3e94b32ccac553908eaefc7a38f
parentd13b0b6d51e78b0107c76d79cf0ef06d9e07650b (diff)
staging: vt6656: Fix URB submitted while active warning.
This error happens because PIPEnsControlOut and PIPEnsControlIn unlock the spin lock for delay, letting in another thread. The patch moves the current MP_SET_FLAG to before filling of sUsbCtlRequest for pControlURB and clears it in event of failing. Any thread calling either function while fMP_CONTROL_READS or fMP_CONTROL_WRITES flags set will return STATUS_FAILURE. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Cc: stable@vger.kernel.org # 3.8 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/vt6656/usbpipe.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index 2a020672a14b..22a3dde75aba 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -126,6 +126,11 @@ int PIPEnsControlOut(struct vnt_private *pDevice, u8 byRequest, u16 wValue,
126 if (pDevice->Flags & fMP_CONTROL_WRITES) 126 if (pDevice->Flags & fMP_CONTROL_WRITES)
127 return STATUS_FAILURE; 127 return STATUS_FAILURE;
128 128
129 if (pDevice->Flags & fMP_CONTROL_READS)
130 return STATUS_FAILURE;
131
132 MP_SET_FLAG(pDevice, fMP_CONTROL_WRITES);
133
129 pDevice->sUsbCtlRequest.bRequestType = 0x40; 134 pDevice->sUsbCtlRequest.bRequestType = 0x40;
130 pDevice->sUsbCtlRequest.bRequest = byRequest; 135 pDevice->sUsbCtlRequest.bRequest = byRequest;
131 pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue); 136 pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue);
@@ -140,12 +145,13 @@ int PIPEnsControlOut(struct vnt_private *pDevice, u8 byRequest, u16 wValue,
140 145
141 ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC); 146 ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC);
142 if (ntStatus != 0) { 147 if (ntStatus != 0) {
143 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control send request submission failed: %d\n", ntStatus); 148 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
149 "control send request submission failed: %d\n",
150 ntStatus);
151 MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES);
144 return STATUS_FAILURE; 152 return STATUS_FAILURE;
145 } 153 }
146 else { 154
147 MP_SET_FLAG(pDevice, fMP_CONTROL_WRITES);
148 }
149 spin_unlock_irq(&pDevice->lock); 155 spin_unlock_irq(&pDevice->lock);
150 for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { 156 for (ii = 0; ii <= USB_CTL_WAIT; ii ++) {
151 157
@@ -179,6 +185,11 @@ int PIPEnsControlIn(struct vnt_private *pDevice, u8 byRequest, u16 wValue,
179 if (pDevice->Flags & fMP_CONTROL_READS) 185 if (pDevice->Flags & fMP_CONTROL_READS)
180 return STATUS_FAILURE; 186 return STATUS_FAILURE;
181 187
188 if (pDevice->Flags & fMP_CONTROL_WRITES)
189 return STATUS_FAILURE;
190
191 MP_SET_FLAG(pDevice, fMP_CONTROL_READS);
192
182 pDevice->sUsbCtlRequest.bRequestType = 0xC0; 193 pDevice->sUsbCtlRequest.bRequestType = 0xC0;
183 pDevice->sUsbCtlRequest.bRequest = byRequest; 194 pDevice->sUsbCtlRequest.bRequest = byRequest;
184 pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue); 195 pDevice->sUsbCtlRequest.wValue = cpu_to_le16p(&wValue);
@@ -192,10 +203,11 @@ int PIPEnsControlIn(struct vnt_private *pDevice, u8 byRequest, u16 wValue,
192 203
193 ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC); 204 ntStatus = usb_submit_urb(pDevice->pControlURB, GFP_ATOMIC);
194 if (ntStatus != 0) { 205 if (ntStatus != 0) {
195 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"control request submission failed: %d\n", ntStatus); 206 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO
196 }else { 207 "control request submission failed: %d\n", ntStatus);
197 MP_SET_FLAG(pDevice, fMP_CONTROL_READS); 208 MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS);
198 } 209 return STATUS_FAILURE;
210 }
199 211
200 spin_unlock_irq(&pDevice->lock); 212 spin_unlock_irq(&pDevice->lock);
201 for (ii = 0; ii <= USB_CTL_WAIT; ii ++) { 213 for (ii = 0; ii <= USB_CTL_WAIT; ii ++) {