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: <20210827085410.GA9183@kili>
Date:   Fri, 27 Aug 2021 11:54:10 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Vinod Koul <vkoul@...nel.org>
Cc:     Lad Prabhakar <prabhakar.mahadev-lad.rj@...renesas.com>,
        Biju Das <biju.das.jz@...renesas.com>,
        dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org,
        kernel-janitors@...r.kernel.org
Subject: [PATCH] dmaengine: sh: fix some NULL dereferences

The dma_free_coherent() function needs a valid device pointer or it will
crash.

Fixes: 550c591a89a1 ("dmaengine: sh: Add DMAC driver for RZ/G2L SoC")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
This means that remove() has not been tested.

 drivers/dma/sh/rz-dmac.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
index 11986a8d22fc..7c1db6a5b365 100644
--- a/drivers/dma/sh/rz-dmac.c
+++ b/drivers/dma/sh/rz-dmac.c
@@ -921,7 +921,7 @@ static int rz_dmac_probe(struct platform_device *pdev)
 	for (i = 0; i < channel_num; i++) {
 		struct rz_dmac_chan *channel = &dmac->channels[i];
 
-		dma_free_coherent(NULL,
+		dma_free_coherent(&pdev->dev,
 				  sizeof(struct rz_lmdesc) * DMAC_NR_LMDESC,
 				  channel->lmdesc.base,
 				  channel->lmdesc.base_dma);
@@ -938,7 +938,7 @@ static int rz_dmac_remove(struct platform_device *pdev)
 	for (i = 0; i < dmac->n_channels; i++) {
 		struct rz_dmac_chan *channel = &dmac->channels[i];
 
-		dma_free_coherent(NULL,
+		dma_free_coherent(&pdev->dev,
 				  sizeof(struct rz_lmdesc) * DMAC_NR_LMDESC,
 				  channel->lmdesc.base,
 				  channel->lmdesc.base_dma);
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ