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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240823-fix_have_async-v1-1-43a354b6614b@quicinc.com>
Date: Fri, 23 Aug 2024 07:46:09 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
 "Rafael J. Wysocki" <rafael@...nel.org>, 
 Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc: Zijun Hu <zijun_hu@...oud.com>, linux-kernel@...r.kernel.org, 
 Zijun Hu <quic_zijuhu@...cinc.com>, stable@...r.kernel.org
Subject: [PATCH] driver core: Fix an uninitialized variable is used by
 __device_attach()

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

An uninitialized variable @data.have_async may be used as analyzed
by the following inline comments:

static int __device_attach(struct device *dev, bool allow_async)
{
	// if @allow_async is true.

	...
	struct device_attach_data data = {
		.dev = dev,
		.check_async = allow_async,
		.want_async = false,
	};
	// @data.have_async is not initialized.

	...
	ret = bus_for_each_drv(dev->bus, NULL, &data,
			__device_attach_driver);
	// @data.have_async must not be set by __device_attach_driver() if
 	// @dev->bus does not have driver which allows probe asynchronously

	if (!ret && allow_async && data.have_async) {
	// Above @data.have_async is not uninitialized but used.
		...
	}
	...
}

It may be unnecessary to trigger the second pass probing asynchronous
drivers for the device @dev.

Fixed by initializing @data.have_async to false.

Fixes: 765230b5f084 ("driver-core: add asynchronous probing support for drivers")
Cc: stable@...r.kernel.org
Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
 drivers/base/dd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index 9b745ba54de1..b0c44b0846aa 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -1021,6 +1021,7 @@ static int __device_attach(struct device *dev, bool allow_async)
 			.dev = dev,
 			.check_async = allow_async,
 			.want_async = false,
+			.have_async = false,
 		};
 
 		if (dev->parent)

---
base-commit: 87ee9981d1f86ee9b1623a46c7f9e4ac24461fe4
change-id: 20240823-fix_have_async-3a135618d91b

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ