Re: [patch] [bugfix] loop.c

From: Eric Dumazet
Date: Fri Mar 23 2007 - 10:51:41 EST


On Fri, 23 Mar 2007 15:25:23 +0100 (CET)
Jiri Kosina <jikos@xxxxxxxx> wrote:

> On Fri, 23 Mar 2007, Eric Dumazet wrote:
>
> > - if (max_loop < 1 || max_loop > 256) {
> > - printk(KERN_WARNING "loop: invalid max_loop (must be between"
> > - " 1 and 256), using default (8)\n");
> > + if (max_loop < 1) {
> > + printk(KERN_WARNING "loop: invalid max_loop (must be > 1)"
> > + ", using default (8)\n");
> > max_loop = 8;
> > }
> [...]
> > + loop_dev = kmalloc(max_loop * sizeof(struct loop_device *), GFP_KERNEL);
> > + if (!loop_dev) {
> > + loop_dev = vmalloc(max_loop * sizeof(struct loop_device *));
> > + if (!loop_dev)
> > + goto out_mem;
> > + loop_dev_vmalloced = 1;
> > }
>
> Why did you remove the upper bound check for max_loop value? Now you
> effectively allow to max_loop * sizeof(struct loop_device *) to overflow,
> when passed value of max_loop which is large enough. Or am I just blind?

Yes, I forgot to change this, but the new limit was 16384 in my mind

MODULE_PARM_DESC(max_loop, "Maximum number of loop devices (1-16384)");

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/