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]
Date:   Thu, 28 Jan 2021 00:01:22 +0100
From:   Uwe Kleine-König <uwe@...ine-koenig.org>
To:     Dan Williams <dan.j.williams@...el.com>,
        Vishal Verma <vishal.l.verma@...el.com>,
        Dave Jiang <dave.jiang@...el.com>
Cc:     linux-nvdimm@...ts.01.org, linux-kernel@...r.kernel.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: [PATCH 1/3] device-dax: Prevent registering drivers without probe or remove callback

The bus probe and remove functions (dax_bus_probe and dax_bus_remove
respectively) call these functions without checking them to be non-NULL.
Add a check to prevent a NULL pointer exception.

Signed-off-by: Uwe Kleine-König <uwe@...ine-koenig.org>
---
 drivers/dax/bus.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c
index 737b207c9e30..618d462975ba 100644
--- a/drivers/dax/bus.c
+++ b/drivers/dax/bus.c
@@ -1392,6 +1392,14 @@ int __dax_driver_register(struct dax_device_driver *dax_drv,
 	struct device_driver *drv = &dax_drv->drv;
 	int rc = 0;
 
+	/*
+	 * dax_bus_probe() calls dax_drv->probe() unconditionally and
+	 * dax_bus_remove() calls dax_drv->remove() unconditionally. So better
+	 * be safe than sorry and ensure these are provided.
+	 */
+	if (!dax_drv->probe || !dax_drv->remove)
+		return -EINVAL;
+
 	INIT_LIST_HEAD(&dax_drv->ids);
 	drv->owner = module;
 	drv->name = mod_name;

base-commit: 5c8fe583cce542aa0b84adc939ce85293de36e5e
-- 
2.29.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ