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: <1366364534-3298-1-git-send-email-lars@metafoo.de>
Date:	Fri, 19 Apr 2013 11:42:13 +0200
From:	Lars-Peter Clausen <lars@...afoo.de>
To:	Vinod Koul <vinod.koul@...el.com>
Cc:	Arnd Bergmann <arnd@...db.de>, Jon Hunter <jon-hunter@...com>,
	linux-kernel@...r.kernel.org, Lars-Peter Clausen <lars@...afoo.de>
Subject: [PATCH 1/2] dma: of: Fix of_node reference leak

of_dma_request_slave_channel() currently does not drop the reference to the
dma_spec of_node if no DMA controller matching the of_node could be found. This
patch fixes it by always calling of_node_put().

Signed-off-by: Lars-Peter Clausen <lars@...afoo.de>
---
 drivers/dma/of-dma.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
index 8266893..2882403 100644
--- a/drivers/dma/of-dma.c
+++ b/drivers/dma/of-dma.c
@@ -221,12 +221,13 @@ struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
 
 		ofdma = of_dma_get_controller(&dma_spec);
 
-		if (!ofdma)
-			continue;
-
-		chan = ofdma->of_dma_xlate(&dma_spec, ofdma);
+		if (ofdma) {
+			chan = ofdma->of_dma_xlate(&dma_spec, ofdma);
 
-		of_dma_put_controller(ofdma);
+			of_dma_put_controller(ofdma);
+		} else {
+			chan = NULL;
+		}
 
 		of_node_put(dma_spec.np);
 
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ