md/raid10: initialize r10_bio->read_slot before use.
authorKevin Vigor <kvigor@gmail.com>
Fri, 6 Nov 2020 22:20:34 +0000 (14:20 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 6 Jan 2021 13:56:49 +0000 (14:56 +0100)
commit5ef98378eff84b8f9d4e33de98011e2f7aa642eb
tree8275659ae569a98f5becda43e14f5f13106fcfc9
parent62162b322364f0b07608aae5cfa80868fe25fb06
md/raid10: initialize r10_bio->read_slot before use.

commit 93decc563637c4288380912eac0eb42fb246cc04 upstream.

In __make_request() a new r10bio is allocated and passed to
raid10_read_request(). The read_slot member of the bio is not
initialized, and the raid10_read_request() uses it to index an
array. This leads to occasional panics.

Fix by initializing the field to invalid value and checking for
valid value in raid10_read_request().

Cc: stable@vger.kernel.org
Signed-off-by: Kevin Vigor <kvigor@gmail.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/raid10.c