md/raid10: fix bug when raid10 recovery fails to recover a block.
authorNeilBrown <neilb@suse.de>
Sun, 5 Jan 2014 23:35:34 +0000 (10:35 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Jan 2014 16:27:12 +0000 (08:27 -0800)
commit16342c21c94760ac4d426371546d4f9e27758e1b
treee20a5fca5dbf14a442b6bbd588a575a1f7c65f2b
parentbb4a65df3097524be403d455176710aee14d41f7
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>
drivers/md/raid10.c