]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
md: Fix md_seq_ops() regressions
authorYu Kuai <yukuai3@huawei.com>
Tue, 9 Jan 2024 13:39:57 +0000 (21:39 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Feb 2025 12:10:53 +0000 (04:10 -0800)
commit8fab939c5d62e9c64bc89ea514f2e7ed886cb671
treee237a52c392c50ae243161339b9bb584053fb4b2
parent4b79bee3e3c0b66b18fbb6187d68927366c8f3b5
md: Fix md_seq_ops() regressions

commit f9cfe7e7f96a9414a17d596e288693c4f2325d49 upstream.

Commit cf1b6d4441ff ("md: simplify md_seq_ops") introduce following
regressions:

1) If list all_mddevs is emptly, personalities and unused devices won't
   be showed to user anymore.
2) If seq_file buffer overflowed from md_seq_show(), then md_seq_start()
   will be called again, hence personalities will be showed to user
   again.
3) If seq_file buffer overflowed from md_seq_stop(), seq_read_iter()
   doesn't handle this, hence unused devices won't be showed to user.

Fix above problems by printing personalities and unused devices in
md_seq_show().

Fixes: cf1b6d4441ff ("md: simplify md_seq_ops")
Cc: stable@vger.kernel.org # v6.7+
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Signed-off-by: Song Liu <song@kernel.org>
Link: https://lore.kernel.org/r/20240109133957.2975272-1-yukuai1@huaweicloud.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/md.c