[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070309063327.GM29544@hexapodia.org>
Date: Thu, 8 Mar 2007 22:33:27 -0800
From: Andy Isaacson <adi@...apodia.org>
To: Bill Davidsen <davidsen@....com>
Cc: linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Neil Brown <neilb@...e.de>, linux-raid@...r.kernel.org
Subject: Re: [PATCH] fix read past end of array in md/linear.c
On Thu, Mar 08, 2007 at 09:37:46PM -0500, Bill Davidsen wrote:
> Andy Isaacson wrote:
> >% dd bs=1 seek=840716287 if=/dev/zero of=d1 count=1
> >% for i in 2 3 4; do dd if=/dev/zero of=d$i bs=1k count=$(($i+150)); done
[snip]
> >- for (j=i; i<cnt-1 && sz < min_spacing ; j++)
> >+ for (j=i; j<cnt-1 && sz < min_spacing ; j++)
> > sz += conf->disks[j].size;
>
> After looking at that code, I have to wonder how this ever worked, or if
> in fact anyone ever took this path. I assume that the value of sz caused
> the loop exit in all cases, since this has been in the code at least
> since 2.6.15, oldest thing I have handy.
Well, just about any sane set of device sizes causes sz to rapidly
exceed min_spacing. You'll notice that my failure case is
{ 800MB, 151kB, 152kB, 153kB, 154kB }.
And even in the failure case, it's just a read from uninitialized
memory, which is probably either a small value (so it won't make the
answer very wrong) or a large value (so it will be rejected in the
immediately following code). In my case it happened to be some slab
poison of 0xa5a5a5a5 or something like that, and the code went on just
fine.
-andy
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists