mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-14 17:46:54 +07:00
MD: fix null pointer deference
The md device might not have personality (for example, ddf raid array). The issue is introduced by 8430e7e0af9a15(md: disconnect device from personality before trying to remove it) Reported-by: kernel test robot <xiaolong.ye@intel.com> Signed-off-by: Shaohua Li <shli@fb.com>
This commit is contained in:
parent
0e5313e2d4
commit
5d8817833c
@ -2595,8 +2595,10 @@ state_store(struct md_rdev *rdev, const char *buf, size_t len)
|
|||||||
else
|
else
|
||||||
err = -EBUSY;
|
err = -EBUSY;
|
||||||
} else if (cmd_match(buf, "remove")) {
|
} else if (cmd_match(buf, "remove")) {
|
||||||
clear_bit(Blocked, &rdev->flags);
|
if (rdev->mddev->pers) {
|
||||||
remove_and_add_spares(rdev->mddev, rdev);
|
clear_bit(Blocked, &rdev->flags);
|
||||||
|
remove_and_add_spares(rdev->mddev, rdev);
|
||||||
|
}
|
||||||
if (rdev->raid_disk >= 0)
|
if (rdev->raid_disk >= 0)
|
||||||
err = -EBUSY;
|
err = -EBUSY;
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user