]> git.baikalelectronics.ru Git - kernel.git/commit
md/raid1: avoid overflow in raid1 resync when bitmap is in use.
authorNeilBrown <neilb@suse.de>
Thu, 7 Oct 2010 00:54:46 +0000 (11:54 +1100)
committerNeilBrown <neilb@suse.de>
Thu, 7 Oct 2010 00:54:46 +0000 (11:54 +1100)
commitfa7593d7c0b96547de2012899823cfca6ab75ee4
treeecdc5d71d3d957604a172c23ef9943438ccee949
parent3813e8f6391e85faa66479d42b46157e6b00fa52
md/raid1:  avoid overflow in raid1 resync when bitmap is in use.

bitmap_start_sync returns - via a pass-by-reference variable - the
number of sectors before we need to check with the bitmap again.
Since commit 27177d5b8f13bc04 this number can be substantially larger,
2^27 is a common value.

Unfortunately it is an 'int' and so when raid1.c:sync_request shifts
it 9 places to the left it becomes 0.  This results in a zero-length
read which the scsi layer justifiably complains about.

This patch just removes the shift so the common case becomes safe with
a trivially-correct patch.

In the next merge window we will convert this 'int' to a 'sector_t'

Reported-by: "George Spelvin" <linux@horizon.com>
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/raid1.c