md: make sure desc_nr less than MD_SB_DISKS
authorYufen Yu <yuyufen@huawei.com>
Tue, 10 Dec 2019 07:01:29 +0000 (15:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 4 Jan 2020 18:18:34 +0000 (19:18 +0100)
commit33ecb96148d61defc779bf4df47ba0d6e02129a4
treebb1ee6704fddcfc49c987aadca09269c312449a5
parent09bc029f759996193b36e46321bc305fc3a284d6
md: make sure desc_nr less than MD_SB_DISKS

[ Upstream commit 3b7436cc9449d5ff7fa1c1fd5bc3edb6402ff5b8 ]

For super_90_load, we need to make sure 'desc_nr' less
than MD_SB_DISKS, avoiding invalid memory access of 'sb->disks'.

Fixes: 228fc7d76db6 ("md: avoid invalid memory access for array sb->dev_roles")
Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/md.c