]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
md/raid10: prevent access of uninitialized resync_pages offset
authorJohn Pittman <jpittman@redhat.com>
Tue, 12 Nov 2019 00:43:20 +0000 (16:43 -0800)
committerSong Liu <songliubraving@fb.com>
Tue, 12 Nov 2019 00:47:39 +0000 (16:47 -0800)
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>
drivers/md/raid10.c

index 2eca0a81a8c9996b85f63c01fc2b5b0a7f6bc855..ec136e44aef7f89067a3320878f49d94c108d8a5 100644 (file)
@@ -191,7 +191,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: