summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorJohn Pittman <jpittman@redhat.com>2019-11-11 16:43:20 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-01 09:14:17 +0100
commit02e98a0d49ba63e70af4da25a728ab51d7e6bee8 (patch)
tree80213f1e46ce8b1b99c445c01ba2a6795da41db2 /drivers/md
parent91bb5e09c9c9820e67e962d5bb00bfb86dcfbf48 (diff)
md/raid10: prevent access of uninitialized resync_pages offset
commit 45422b704db392a6d79d07ee3e3670b11048bd53 upstream. Due to unneeded multiplication in the out_free_pages portion of r10buf_pool_alloc(), when using a 3-copy raid10 layout, it is possible to access a resync_pages offset that has not been initialized. This access translates into a crash of the system within resync_free_pages() while passing a bad pointer to put_page(). Remove the multiplication, preventing access to the uninitialized area. Fixes: f0250618361db ("md: raid10: don't use bio's vec table to manage resync pages") Cc: stable@vger.kernel.org # 4.12+ Signed-off-by: John Pittman <jpittman@redhat.com> Suggested-by: David Jeffery <djeffery@redhat.com> Reviewed-by: Laurence Oberman <loberman@redhat.com> Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid10.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 433e78f453da..d08d77b9674f 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -226,7 +226,7 @@ static void * r10buf_pool_alloc(gfp_t gfp_flags, void *data)
out_free_pages:
while (--j >= 0)
- resync_free_pages(&rps[j * 2]);
+ resync_free_pages(&rps[j]);
j = 0;
out_free_bio: