From: Herbert Poetzl Date: Sun, 26 Mar 2006 09:37:30 +0000 (-0800) Subject: [PATCH] loop: potential kernel hang waiting for kthread X-Git-Tag: MMI-PSA29.97-13-9~51042 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3e88c17d404c5787afd5bd1763380317f5ccbf84;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [PATCH] loop: potential kernel hang waiting for kthread Check that kernel_thread() succeeded, so we don't wait for something which cannot happen. Signed-off-by: Herbert Poetzl Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 74bf0255e98f..9c3b94e8f03b 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c @@ -839,7 +839,9 @@ static int loop_set_fd(struct loop_device *lo, struct file *lo_file, set_blocksize(bdev, lo_blocksize); - kernel_thread(loop_thread, lo, CLONE_KERNEL); + error = kernel_thread(loop_thread, lo, CLONE_KERNEL); + if (error < 0) + goto out_putf; wait_for_completion(&lo->lo_done); return 0;