Skip to contentSkip to conversation

ocfs2: fix double kmem_cache_destroy in dlm_init

PATCH New Joseph Qi 1 participant 1 message May 14, 2014 OCFS2

lore
Share & tools
lore

Joseph Qi

author
#0 lore raw

PATCH 1/1 ocfs2: fix double kmem_cache_destroy in dlm_init

In dlm_init, if create dlm_lockname_cache failed in dlm_init_master_caches, it will destroy dlm_lockres_cache which created before twice. And this will cause system die when loading modules.

---
 fs/ocfs2/dlm/dlmmaster.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/ocfs2/dlm/dlmmaster.c +6 -2
index af3f7aa..ee1f884 100644
@@ -472,11 +472,15 @@ bail:
 
 void dlm_destroy_master_caches(void)
 {
-	if (dlm_lockname_cache)
+	if (dlm_lockname_cache) {
 		kmem_cache_destroy(dlm_lockname_cache);
+		dlm_lockname_cache = NULL;
+	}
 
-	if (dlm_lockres_cache)
+	if (dlm_lockres_cache) {
 		kmem_cache_destroy(dlm_lockres_cache);
+		dlm_lockres_cache = NULL;
+	}
 }
 
 static void dlm_lockres_release(struct kref *kref)
Signature · 1 line
1.8.4.3