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]
Message-ID: <20240410074033.2523399-3-chengzhihao1@huawei.com>
Date: Wed, 10 Apr 2024 15:40:33 +0800
From: Zhihao Cheng <chengzhihao1@...wei.com>
To: <richard@....at>, <daniel@...rotopia.org>
CC: <linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/2] ubi: ubi_init: Fix missed ubiblock cleanup in error handling path

The ubiblock_init called by ubi_init will register device number, but
device number is not released in error handling path of ubi_init when
ubi is loaded by inserting module (eg. attaching failure), which leads
to subsequent ubi_init calls failed by running out of device number
(dmesg shows that "__register_blkdev: failed to get major for ubiblock").
Fix it by invoking ubiblock_exit() in corresponding error handling path.

Fixes: 927c145208b0 ("mtd: ubi: attach from device tree")
Signed-off-by: Zhihao Cheng <chengzhihao1@...wei.com>
---
 drivers/mtd/ubi/build.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 7f95fd7968a8..354517194099 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -1380,12 +1380,13 @@ static int __init ubi_init(void)
 	if (ubi_is_module()) {
 		err = ubi_init_attach();
 		if (err)
-			goto out_mtd_notifier;
+			goto out_block_exit;
 	}
 
 	return 0;
 
-out_mtd_notifier:
+out_block_exit:
+	ubiblock_exit();
 	unregister_mtd_user(&ubi_mtd_notifier);
 out_debugfs:
 	ubi_debugfs_exit();
-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ