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: v2.6.17-rc1~626 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3e88c17d404c5787afd5bd1763380317f5ccbf84;p=linux-2.6 [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 74bf0255e9..9c3b94e8f0 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;