• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

linux-3.0.x for AP-SH4A-0A Board


Commit MetaInfo

Revisionefa73f1334e339902993bb4894da47242f0c4173 (tree)
Time2011-08-05 13:58:31
AuthorTobias Klauser <tklauser@dist...>
CommiterGreg Kroah-Hartman

Log Message

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 Summary

Incremental Difference

--- 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)
846846 }
847847
848848 /* kill threads related to this sdev, if v.c. exists */
849- if (vdev->ud.tcp_rx)
849+ if (vdev->ud.tcp_rx && !task_is_dead(vdev->ud.tcp_rx))
850850 kthread_stop(vdev->ud.tcp_rx);
851- if (vdev->ud.tcp_tx)
851+ if (vdev->ud.tcp_tx && !task_is_dead(vdev->ud.tcp_tx))
852852 kthread_stop(vdev->ud.tcp_tx);
853853
854854 pr_info("stop threads\n");