]> git.proxmox.com Git - mirror_ubuntu-kernels.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)
committerJens Axboe <axboe@kernel.dk>
Wed, 3 Aug 2022 03:08:53 +0000 (21:08 -0600)
commit104212471b1c1817b311771d817fb692af983173
treeaa5da3b1c20aaf39f7f759ce4d667889a3385721
parent20313b1b8cd1bda34ee136b656c39ff2ae189330
drivers:md:fix a potential use-after-free bug

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>
drivers/md/raid5.c