This is a note to let you know that I've just added the patch titled

    Staging: usbip: vhci-hcd: Do not kill already dead RX/TX kthread

to the 3.0-stable tree which can be found at:
    
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     staging-usbip-vhci-hcd-do-not-kill-already-dead-rx-tx-kthread.patch
and it can be found in the queue-3.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From 8547d4cc2b616e4f1dafebe2c673fc986422b506 Mon Sep 17 00:00:00 2001
From: Tobias Klauser <[email protected]>
Date: Fri, 24 Jun 2011 15:48:47 +0200
Subject: Staging: usbip: vhci-hcd: Do not kill already dead RX/TX kthread

From: Tobias Klauser <[email protected]>

commit 8547d4cc2b616e4f1dafebe2c673fc986422b506 upstream.

When unbinding a device on the host which was still attached on the
client, I got a NULL pointer dereference on the client. This turned out
to be due to kthread_stop() being called on an already dead kthread.

Here is how I was able to reproduce the problem:

 server:# usbip bind -b 1-2
                                client:# usbip attach -h server -b 1-2
 server:# usbip unbind -b 1-2

This patch fixes the problem by checking the kthread before attempting
to kill it, as it is done on the opposite side in
stub_shutdown_connection().

Signed-off-by: Tobias Klauser <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/staging/usbip/vhci_hcd.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/drivers/staging/usbip/vhci_hcd.c
+++ b/drivers/staging/usbip/vhci_hcd.c
@@ -846,9 +846,9 @@ static void vhci_shutdown_connection(str
        }
 
        /* kill threads related to this sdev, if v.c. exists */
-       if (vdev->ud.tcp_rx)
+       if (vdev->ud.tcp_rx && !task_is_dead(vdev->ud.tcp_rx))
                kthread_stop(vdev->ud.tcp_rx);
-       if (vdev->ud.tcp_tx)
+       if (vdev->ud.tcp_tx && !task_is_dead(vdev->ud.tcp_tx))
                kthread_stop(vdev->ud.tcp_tx);
 
        pr_info("stop threads\n");


Patches currently in stable-queue which might be from [email protected] are

queue-3.0/staging-usbip-vhci-hcd-do-not-kill-already-dead-rx-tx-kthread.patch

_______________________________________________
stable mailing list
[email protected]
http://linux.kernel.org/mailman/listinfo/stable

Reply via email to