diff options
author | NeilBrown <neilb@suse.de> | 2014-01-05 18:35:34 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-01-25 11:27:12 -0500 |
commit | 16342c21c94760ac4d426371546d4f9e27758e1b (patch) | |
tree | e20a5fca5dbf14a442b6bbd588a575a1f7c65f2b /drivers/md/raid10.c | |
parent | bb4a65df3097524be403d455176710aee14d41f7 (diff) |
md/raid10: fix bug when raid10 recovery fails to recover a block.
commit e8b849158508565e0cd6bc80061124afc5879160 upstream.
commit e875ecea266a543e643b19e44cf472f1412708f9
md/raid10 record bad blocks as needed during recovery.
added code to the "cannot recover this block" path to record a bad
block rather than fail the whole recovery.
Unfortunately this new case was placed *after* r10bio was freed rather
than *before*, yet it still uses r10bio.
This is will crash with a null dereference.
So move the freeing of r10bio down where it is safe.
Fixes: e875ecea266a543e643b19e44cf472f1412708f9
Reported-by: Damian Nowak <spam@nowaker.net>
URL: https://bugzilla.kernel.org/show_bug.cgi?id=68181
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r-- | drivers/md/raid10.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 0add86821755..ff3f8d057e0a 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c | |||
@@ -3198,10 +3198,6 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
3198 | if (j == conf->copies) { | 3198 | if (j == conf->copies) { |
3199 | /* Cannot recover, so abort the recovery or | 3199 | /* Cannot recover, so abort the recovery or |
3200 | * record a bad block */ | 3200 | * record a bad block */ |
3201 | put_buf(r10_bio); | ||
3202 | if (rb2) | ||
3203 | atomic_dec(&rb2->remaining); | ||
3204 | r10_bio = rb2; | ||
3205 | if (any_working) { | 3201 | if (any_working) { |
3206 | /* problem is that there are bad blocks | 3202 | /* problem is that there are bad blocks |
3207 | * on other device(s) | 3203 | * on other device(s) |
@@ -3233,6 +3229,10 @@ static sector_t sync_request(struct mddev *mddev, sector_t sector_nr, | |||
3233 | mirror->recovery_disabled | 3229 | mirror->recovery_disabled |
3234 | = mddev->recovery_disabled; | 3230 | = mddev->recovery_disabled; |
3235 | } | 3231 | } |
3232 | put_buf(r10_bio); | ||
3233 | if (rb2) | ||
3234 | atomic_dec(&rb2->remaining); | ||
3235 | r10_bio = rb2; | ||
3236 | break; | 3236 | break; |
3237 | } | 3237 | } |
3238 | } | 3238 | } |