From: NeilBrown Date: Mon, 1 May 2006 19:15:44 +0000 (-0700) Subject: [PATCH] md: Avoid oops when attempting to fix read errors on raid10 X-Git-Tag: v2.6.16.17~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37f94ce7266457a8d8b463edbebacd9bcedfd183;p=thirdparty%2Fkernel%2Fstable.git [PATCH] md: Avoid oops when attempting to fix read errors on raid10 We should add to the counter for the rdev *after* checking if the rdev is NULL!!! Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Signed-off-by: Chris Wright --- diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index ab90a6d120204..039ed49b3c030 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1436,9 +1436,9 @@ static void raid10d(mddev_t *mddev) sl--; d = r10_bio->devs[sl].devnum; rdev = conf->mirrors[d].rdev; - atomic_add(s, &rdev->corrected_errors); if (rdev && test_bit(In_sync, &rdev->flags)) { + atomic_add(s, &rdev->corrected_errors); if (sync_page_io(rdev->bdev, r10_bio->devs[sl].addr + sect + rdev->data_offset,