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  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:   Sun, 26 Nov 2017 21:13:45 +0800
From:   Peng Fan <peng.fan@....com>
To:     hch@....de, m.szyprowski@...sung.com, robin.murphy@....com,
        gregkh@...uxfoundation.org, robh+dt@...nel.org,
        frowand.list@...il.com
Cc:     iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
        devicetree@...r.kernel.org, van.freenix@...il.com,
        Peng Fan <peng.fan@....com>
Subject: [RFC 1/2] of: reserved_mem: check return value of_dma_configure

In commit <7b07cbefb6>("iommu: of: Handle IOMMU lookup failure
with deferred probing or error"), there is possibility that
of_dma_configure may fail. So in of_reserved_mem_device_init_by_idx,
also need to propagate the return value of_dma_configure to caller,
when need to use reserved memory for a device which needs iommu.

Signed-off-by: Peng Fan <peng.fan@....com>
---
 drivers/of/of_reserved_mem.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 22b75c82e377..61523819b50e 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -357,9 +357,12 @@ int of_reserved_mem_device_init_by_idx(struct device *dev,
 		/* ensure that dma_ops is set for virtual devices
 		 * using reserved memory
 		 */
-		of_dma_configure(dev, np);
-
-		dev_info(dev, "assigned reserved memory node %s\n", rmem->name);
+		ret = of_dma_configure(dev, np);
+		if (ret)
+			of_reserved_mem_device_release(dev);
+		else
+			dev_info(dev, "assigned reserved memory node %s\n",
+				 rmem->name);
 	} else {
 		kfree(rd);
 	}
-- 
2.14.1

Powered by blists - more mailing lists