md/raid10: fix problem with on-stack allocation of r10bio structure.
A 'struct r10bio' has an array of per-copy information at the end. This array is declared with size  and r10bio_pool_alloc allocates enough extra space to store the per-copy information depending on the number of copies needed. So declaring a 'struct r10bio on the stack isn't going to work. It won't allocate enough space, and memory corruption will ensue. So in the two places where this is done, declare a sufficiently large structure and use that instead. The two call-sites of this bug were introduced in 3.4 and 3.5 so this is suitable for both those kernels. The patch will have to be modified for 3.4 as it only has one bug. Cc: email@example.com Reported-by: Ivan Vasilyev <firstname.lastname@example.org> Tested-by: Ivan Vasilyev <email@example.com> Signed-off-by: NeilBrown <firstname.lastname@example.org>
Showing with 20 additions and 12 deletions