Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Staging: usbip: usbip_start_threads(): handle kernel_thread failure

kernel_thread may fail, notice this.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Roel Kluin and committed by
Greg Kroah-Hartman
05d6d677 e48d94da

+14 -2
+14 -2
drivers/staging/usbip/usbip_common.c
··· 406 406 /* 407 407 * threads are invoked per one device (per one connection). 408 408 */ 409 - kernel_thread(usbip_thread, (void *)&ud->tcp_rx, 0); 410 - kernel_thread(usbip_thread, (void *)&ud->tcp_tx, 0); 409 + int retval; 410 + 411 + retval = kernel_thread(usbip_thread, (void *)&ud->tcp_rx, 0); 412 + if (retval < 0) { 413 + printk(KERN_ERR "Creating tcp_rx thread for ud %p failed.\n", 414 + ud); 415 + return; 416 + } 417 + retval = kernel_thread(usbip_thread, (void *)&ud->tcp_tx, 0); 418 + if (retval < 0) { 419 + printk(KERN_ERR "Creating tcp_tx thread for ud %p failed.\n", 420 + ud); 421 + return; 422 + } 411 423 412 424 /* confirm threads are starting */ 413 425 wait_for_completion(&ud->tcp_rx.thread_done);