diff options
author | Tobias Klauser <tklauser@distanz.ch> | 2011-06-24 15:48:47 +0200 |
---|---|---|
committer | Jonas ABERG <jonas.aberg@stericsson.com> | 2011-10-28 11:03:56 +0200 |
commit | 4a7822e8d3d2e9af6cd22e208a928974a78fee04 (patch) | |
tree | c27d3390100708333870e2d212b479f43c1395d8 /drivers | |
parent | ec92a71ab78956449e3633f0c9871a26beb62efb (diff) |
Staging: usbip: vhci-hcd: Do not kill already dead RX/TX kthread
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 <tklauser@distanz.ch>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Change-Id: I9aaa60ee923506237a325afdaf908a5dbd7be60e
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/35585
Tested-by: Per VAHLNE <per.xx.vahlne@stericsson.com>
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/usbip/vhci_hcd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index a76e8fa69b6..76d7485f4e2 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -846,9 +846,9 @@ static void vhci_shutdown_connection(struct usbip_device *ud) } /* 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"); |