[PATCH 1/1][SRU][M] UBUNTU: SAUCE: md: do not _put wrong device in md_seq_next
AceLan Kao
acelan.kao at canonical.com
Fri Sep 15 09:47:29 UTC 2023
From: Mariusz Tkaczyk <mariusz.tkaczyk at linux.intel.com>
BugLink: https://bugs.launchpad.net/bugs/2036184
If there are multiple arrays in system and one mddevice is marked
with MD_DELETED and md_seq_next() is called in the middle of removal
then it _get()s proper device but it may _put() deleted one. As a result,
active counter may never be zeroed for mddevice and it cannot
be removed.
Put the device which has been _get with previous md_seq_next() call.
Cc: Yu Kuai <yukuai3 at huawei.com>
Fixes: 12a6caf27324 ("md: only delete entries from all_mddevs when the disk is freed")
Reported-by: AceLan Kao <acelan at gmail.com>
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=217798
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk at linux.intel.com>
(cherry picked from commit https://patchwork.kernel.org/project/linux-raid/patch/20230914152416.10819-1-mariusz.tkaczyk@linux.intel.com/)
Signed-off-by: Chia-Lin Kao (AceLan) <acelan.kao at canonical.com>
---
drivers/md/md.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 78be7811a89f5..6caeea94d9d71 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -8203,7 +8203,7 @@ static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos)
spin_unlock(&all_mddevs_lock);
if (to_put)
- mddev_put(mddev);
+ mddev_put(to_put);
return next_mddev;
}
--
2.34.1
More information about the kernel-team
mailing list