]> git.baikalelectronics.ru Git - kernel.git/commit
drivers:md:fix a potential use-after-free bug
authorWentao_Liang <Wentao_Liang_g@163.com>
Thu, 28 Jul 2022 11:39:19 +0000 (19:39 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:18:35 +0000 (11:18 +0200)
commitcc3d971a608194918686728ee745dc6a557ee6be
tree9a291c8086b8ce30a9ed375bb787a157dcf41dec
parent4cadb4644d51aac2d10c862fae8b703f448c9da2
drivers:md:fix a potential use-after-free bug

[ Upstream commit 94924c1f0cc6e817db5742d641c8e88290289707 ]

In line 2884, "raid5_release_stripe(sh);" drops the reference to sh and
may cause sh to be released. However, sh is subsequently used in lines
2886 "if (sh->batch_head && sh != sh->batch_head)". This may result in an
use-after-free bug.

It can be fixed by moving "raid5_release_stripe(sh);" to the bottom of
the function.

Signed-off-by: Wentao_Liang <Wentao_Liang_g@163.com>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/raid5.c