stub_shutdown_connection() : drivers/usb/usbip/stub_dev.c
     stub_device_cleanup_urbs() : drivers/usb/usbip/stub_main.c 
requests to kill pending URBs and clears priv lists.

stub_complete() : drivers/usb/usbip/stub_tx.c might be called with URBs 
to have been requested to kill.

To avoid kernel panic, this patch ignores killed URBs linked to cleared 
priv lists.
To know the killed URBs in stub_complete(), sdev->ud.tcp_socket which 
cleared before stub_device_cleanup_urbs() is checked.

The critial condition will happen by unbind command before detach, 
broken connection in connect command and disconnect command. 

Signed-off-by: Nobuo Iwata <nobuo.iw...@fujixerox.co.jp>
---
 drivers/usb/usbip/stub_tx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/usbip/stub_tx.c b/drivers/usb/usbip/stub_tx.c
index dbcabc9..f19f321 100644
--- a/drivers/usb/usbip/stub_tx.c
+++ b/drivers/usb/usbip/stub_tx.c
@@ -97,7 +97,9 @@ void stub_complete(struct urb *urb)
 
        /* link a urb to the queue of tx. */
        spin_lock_irqsave(&sdev->priv_lock, flags);
-       if (priv->unlinking) {
+       if (sdev->ud.tcp_socket == NULL) {
+               dev_info(&urb->dev->dev, "discard a urb for closed connection");
+       } else if (priv->unlinking) {
                stub_enqueue_ret_unlink(sdev, priv->seqnum, urb->status);
                stub_free_priv_and_urb(priv);
        } else {
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to