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: <20240915-bus_add_driver_fix-v1-1-ce5cf1f66601@quicinc.com>
Date: Sun, 15 Sep 2024 18:22:05 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
 "Rafael J. Wysocki" <rafael@...nel.org>
Cc: Zijun Hu <zijun_hu@...oud.com>, linux-kernel@...r.kernel.org, 
 Zijun Hu <quic_zijuhu@...cinc.com>
Subject: [PATCH] driver core: bus: Mark an impossible error path with
 WARN_ON() in bus_add_driver()

From: Zijun Hu <quic_zijuhu@...cinc.com>

driver_attach() called by bus_add_driver() always returns 0, so its
corresponding error path will never happen, hence mark the impossible
error path with WARN_ON() to remind readers to disregard it.

Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
 drivers/base/bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 657c93c38b0d..59a48edda267 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -673,7 +673,7 @@ int bus_add_driver(struct device_driver *drv)
 	klist_add_tail(&priv->knode_bus, &sp->klist_drivers);
 	if (sp->drivers_autoprobe) {
 		error = driver_attach(drv);
-		if (error)
+		if (WARN_ON(error))
 			goto out_del_list;
 	}
 	error = module_add_driver(drv->owner, drv);

---
base-commit: 6a36d828bdef0e02b1e6c12e2160f5b83be6aab5
change-id: 20240915-bus_add_driver_fix-f54841e6a69a

Best regards,
-- 
Zijun Hu <quic_zijuhu@...cinc.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ