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  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]
Date:   Thu, 21 May 2020 19:12:03 +0300
From:   Ioana Ciornei <>
Cc:, Ioana Ciornei <>
Subject: [PATCH] bus: fsl-mc: allocate resources when there is no scan in progress

Allocate resources from the fsl-mc bus only when a scan of the bus is
not happening. This is useful when functional devices on the bus, such
as DPNI, DPSW etc, request some kind of allocatable object but the scan
of the bus is still in progress, thus those resources are not yet
available. Catch this early and notify the upper layer driver of the

Signed-off-by: Ioana Ciornei <>
 drivers/bus/fsl-mc/fsl-mc-allocator.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/fsl-mc/fsl-mc-allocator.c b/drivers/bus/fsl-mc/fsl-mc-allocator.c
index cc7bb900f524..794ddc9589dc 100644
--- a/drivers/bus/fsl-mc/fsl-mc-allocator.c
+++ b/drivers/bus/fsl-mc/fsl-mc-allocator.c
@@ -184,6 +184,9 @@ int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus,
 	BUILD_BUG_ON(ARRAY_SIZE(fsl_mc_pool_type_strings) !=
+	if (!mutex_trylock(&mc_bus->scan_mutex))
+		return -ENXIO;
 	*new_resource = NULL;
 	if (pool_type < 0 || pool_type >= FSL_MC_NUM_POOL_TYPES)
 		goto out;
@@ -197,7 +200,7 @@ int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus,
 					    struct fsl_mc_resource, node);
 	if (!resource) {
-		error = -ENXIO;
+		error = -ENOMEM;
 			"No more resources of type %s left\n",
@@ -220,6 +223,7 @@ int __must_check fsl_mc_resource_allocate(struct fsl_mc_bus *mc_bus,
 	*new_resource = resource;
+	mutex_unlock(&mc_bus->scan_mutex);
 	return error;

Powered by blists - more mailing lists