As Coly pointed out, bcache_exit() may not be able to handle all the
references properly, if userspace registers cache and backing devices
right before bch_debug_init and bch_debug_init failes later.

Signed-off-by: Liang Chen <[email protected]>
---
 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 2a5c38c..c74f7d8 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -2104,9 +2104,9 @@ static int __init bcache_init(void)
 
        if (!(bcache_wq = alloc_workqueue("bcache", WQ_MEM_RECLAIM, 0)) ||
            !(bcache_kobj = kobject_create_and_add("bcache", fs_kobj)) ||
-           sysfs_create_files(bcache_kobj, files) ||
            bch_request_init() ||
-           bch_debug_init(bcache_kobj))
+           bch_debug_init(bcache_kobj) ||
+           sysfs_create_files(bcache_kobj, files))
                goto err;
 
        return 0;
-- 
1.8.3.1

Reply via email to