lkml.org 
[lkml]   [2007]   [May]   [21]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateTue, 22 May 2007 01:18:51 +0100
FromAl Viro <>
SubjectRe: + loop-preallocate-eight-loop-devices.patch added to -mm tree
On Mon, May 21, 2007 at 03:00:55PM -0700, akpm@linux-foundation.org wrote:
> +	if (register_blkdev(LOOP_MAJOR, "loop"))
> +		return -EIO;
> +	blk_register_region(MKDEV(LOOP_MAJOR, 0), range,
> +				  THIS_MODULE, loop_probe, NULL, NULL);
> +
> +	for (i = 0; i < nr; i++) {
> +		if (!loop_init_one(i))
> +			goto err;
> +	}
> +
> +	printk(KERN_INFO "loop: module loaded\n");
> +	return 0;
> +err:
> +	loop_exit();

This isn't good.  You *can't* fail once a single disk has been registered.
Anyone could've opened it by now.

IOW, you need to
	* register region *after* you are past the point of no return
	* either not fail on failing loop_init_one() here, or separate
allocations and actual add_disk().
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-05-22 02:21    [from the cache]
©2003-2008