All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] loop.c: kernel_thread() retval check - 2.6.17.9
@ 2006-08-24  6:41 Julio Auto
  2006-08-28  3:55 ` Solar Designer
  0 siblings, 1 reply; 6+ messages in thread
From: Julio Auto @ 2006-08-24  6:41 UTC (permalink / raw)
  To: Solar Designer; +Cc: Willy Tarreau, linux-kernel, akpm

Hi all,

this is my porting (to 2.6.x) of the loop.c issue reported and patched
by Solar Designer, to whom all credits of the original idea to the
patch go (more info in the original "[PATCH] loop.c: kernel_thread()
retval check" e-mail thread).

Honestly, I couldn't test it on other computers, but mine. But the
tests were made against a stock (unmodified) 2.6.17.9 kernel and the
patch works like it should. Nevertheless, a second thought/review is
always appreciated.

Cheers,

    Julio Auto

Signed-off-by: Julio Auto <mindvortex@gmail.com>

--- drivers/block/loop.c.orig	2006-08-23 11:44:51.000000000 -0700
+++ drivers/block/loop.c	2006-08-24 00:33:54.000000000 -0700
@@ -841,10 +841,20 @@ static int loop_set_fd(struct loop_devic

 	error = kernel_thread(loop_thread, lo, CLONE_KERNEL);
 	if (error < 0)
-		goto out_putf;
+		goto out_clr;
 	wait_for_completion(&lo->lo_done);
 	return 0;

+ out_clr:
+	lo->lo_device = NULL;
+	lo->lo_flags = 0;
+	lo->lo_backing_file = NULL;
+	set_capacity(disks[lo->lo_number], 0);
+	invalidate_bdev(bdev, 0);
+	bd_set_size(bdev, 0);
+	mapping_set_gfp_mask(mapping, lo->old_gfp_mask);
+	lo->lo_state = Lo_unbound;
+
  out_putf:
 	fput(file);
  out:

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-08-28 12:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-24  6:41 [PATCH] loop.c: kernel_thread() retval check - 2.6.17.9 Julio Auto
2006-08-28  3:55 ` Solar Designer
2006-08-28  4:41   ` Andrew Morton
2006-08-28  5:03     ` Julio Auto
2006-08-28 12:50       ` Serge E. Hallyn
2006-08-28  4:52   ` Julio Auto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.