lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 30 Aug 2023 17:29:02 +0800
From:   Yu Kuai <yukuai1@...weicloud.com>
To:     song@...nel.org, xni@...hat.com
Cc:     linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
        yukuai3@...wei.com, yukuai1@...weicloud.com, yi.zhang@...wei.com,
        yangerkun@...wei.com
Subject: [PATCH -next 2/2] md: fix potential hang for mddev_suspend()

From: Yu Kuai <yukuai3@...wei.com>

Commit 72adae23a72c ("md: Change active_io to percpu") drop that if
'active_io' is decreased to 0 and array is suspended, 'sb_wait' will be
woke up. This is wrong, however, there is no regression reported and I
think this is probably because 'sb_wait' is used in many scenarios and
it's woke up from other context.

Anyway, fix this potential problem by waking up 'sb_wait' in this case.

Fixes: 72adae23a72c ("md: Change active_io to percpu")
Signed-off-by: Yu Kuai <yukuai3@...wei.com>
---
 drivers/md/md.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index 0d69b1a2e2d5..1c7eb3cfadb4 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -399,6 +399,9 @@ static bool md_array_enter(struct mddev *mddev, struct bio *bio)
 static void md_array_exit(struct mddev *mddev)
 {
 	percpu_ref_put(&mddev->active_io);
+	if (percpu_ref_is_zero(&mddev->active_io) &&
+	    wq_has_sleeper(&mddev->sb_wait))
+		wake_up(&mddev->sb_wait);
 }
 
 void md_handle_request(struct mddev *mddev, struct bio *bio)
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ