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: <20231211082510.262292-1-chentao@kylinos.cn>
Date:   Mon, 11 Dec 2023 16:25:10 +0800
From:   Kunwu Chan <chentao@...inos.cn>
To:     colyli@...e.de, kent.overstreet@...il.com
Cc:     linux-bcache@...r.kernel.org, linux-kernel@...r.kernel.org,
        Kunwu Chan <chentao@...inos.cn>,
        Kunwu Chan <kunwu.chan@...mail.com>
Subject: [PATCH] bcache: Fix NULL pointer dereference in bch_cached_dev_run

kasprintf() returns a pointer to dynamically allocated memory
which can be NULL upon failure.

Cc: Kunwu Chan <kunwu.chan@...mail.com>
Signed-off-by: Kunwu Chan <chentao@...inos.cn>
---
 drivers/md/bcache/super.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
index 1402096b8076..40b657887d3b 100644
--- a/drivers/md/bcache/super.c
+++ b/drivers/md/bcache/super.c
@@ -1053,6 +1053,12 @@ int bch_cached_dev_run(struct cached_dev *dc)
 		NULL,
 	};
 
+	if (!env[1] || !env[2]) {
+		pr_err("Couldn't create bcache dev <-> fail to allocate memory\n");
+		ret = -ENOMEM;
+		goto out;
+	}
+
 	if (dc->io_disable) {
 		pr_err("I/O disabled on cached dev %pg\n", dc->bdev);
 		ret = -EIO;
-- 
2.39.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ