md/raid10: remove use-after-free bug.
authorNeilBrown <neilb@suse.de>
Wed, 24 Jul 2013 05:37:42 +0000 (15:37 +1000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Aug 2013 08:50:55 +0000 (16:50 +0800)
commit5a4de615144fd87589783402cab3ecbc29865fc8
treee0115a3be78f242bf915cd679226bd2578815690
parentc1dadcc1086bbbac1b5eeb4d5e157c76f2d8dfba
md/raid10: remove use-after-free bug.

commit 0eb25bb027a100f5a9df8991f2f628e7d851bc1e upstream.

We always need to be careful when calling generic_make_request, as it
can start a chain of events which might free something that we are
using.

Here is one place I wasn't careful enough.  If the wbio2 is not in
use, then it might get freed at the first generic_make_request call.
So perform all necessary tests first.

This bug was introduced in 3.3-rc3 (24afd80d99) and can cause an
oops, so fix is suitable for any -stable since then.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/raid10.c