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-next>] [day] [month] [year] [list]
Message-Id: <1648523845-4681-1-git-send-email-daihuaigang129@163.com>
Date:   Tue, 29 Mar 2022 11:17:25 +0800
From:   daihuaigang129@....com
To:     colyli@...e.de, kent.overstreet@...il.com
Cc:     linux-bcache@...r.kernel.org, linux-kernel@...r.kernel.org,
        daihuaigang <daihuaigang129@....com>
Subject: [PATCH v1] bcache: fix AB-BA deadlock between cache register and cache_set_free

From: daihuaigang <daihuaigang129@....com>

bcache register add kobject_mutex then bch_register_mutex,
cache_set_free add bch_register_mutex then kobject_mutex.
fix AB-BA deadlock between cache register and cache_set_free.

Signed-off-by: daihuaigang <daihuaigang129@....com>
---
 drivers/md/bcache/super.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index bf3de14..f17953c 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1690,10 +1690,8 @@ static void cache_set_free(struct closure *cl)
 	if (ca) {
 		ca->set = NULL;
 		c->cache = NULL;
-		kobject_put(&ca->kobj);
 	}
 
-
 	if (c->moving_gc_wq)
 		destroy_workqueue(c->moving_gc_wq);
 	bioset_exit(&c->bio_split);
@@ -1704,6 +1702,8 @@ static void cache_set_free(struct closure *cl)
 
 	list_del(&c->list);
 	mutex_unlock(&bch_register_lock);
+	if (ca)
+		kobject_put(&ca->kobj);
 
 	pr_info("Cache set %pU unregistered\n", c->set_uuid);
 	wake_up(&unregister_wait);
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ