]> git.baikalelectronics.ru Git - kernel.git/commit
[PATCH] md: avoid reading past the end of a bitmap file
authorNeilBrown <neilb@suse.de>
Fri, 26 Jan 2007 08:57:03 +0000 (00:57 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 26 Jan 2007 21:50:59 +0000 (13:50 -0800)
commit39d45bbe3ba01aff116d9b6d44c6d67d6bb72162
tree32dee76e54b4922eac8ab09c30b1e8399b3107aa
parent18fe6da32d3b2ea5b36688a8691c49257bab194c
[PATCH] md: avoid reading past the end of a bitmap file

In most cases we check the size of the bitmap file before reading data from
it.  However when reading the superblock, we always read the first PAGE_SIZE
bytes, which might not always be appropriate.  So limit that read to the size
of the file if appropriate.

Also, we get the count of available bytes wrong in one place, so that too can
read past the end of the file.

Cc: "yang yin" <yinyang801120@gmail.com>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/md/bitmap.c