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]
Date:   Mon, 17 Jul 2023 20:42:40 +0530
From:   Akhil R <akhilrajeev@...dia.com>
To:     <christian.koenig@....com>, <digetx@...il.com>,
        <jonathanh@...dia.com>, <ldewangan@...dia.com>,
        <linux-i2c@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-tegra@...r.kernel.org>, <sumit.semwal@...aro.org>,
        <thierry.reding@...il.com>, <wsa@...nel.org>
CC:     <akhilrajeev@...dia.com>
Subject: [PATCH] i2c: tegra: Fix the check during DMA channel release

Check for error and NULL before attempting to release DMA channel.

This, otherwise, was causing panic and crash in kernel when the
dma_chan has an invalid value. The condition occurs during init_dma()
when the dma_request_chan() function returns an error.

Fixes: fcc8a89a1c83 ("i2c: tegra: Share same DMA channel for RX and TX")
Signed-off-by: Akhil R <akhilrajeev@...dia.com>
---
 drivers/i2c/busses/i2c-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index bcbbf23aa530..636bf340e707 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -427,7 +427,7 @@ static void tegra_i2c_release_dma(struct tegra_i2c_dev *i2c_dev)
 		i2c_dev->dma_buf = NULL;
 	}
 
-	if (i2c_dev->dma_chan) {
+	if (!IS_ERR_OR_NULL(i2c_dev->dma_chan)) {
 		dma_release_channel(i2c_dev->dma_chan);
 		i2c_dev->dma_chan = NULL;
 	}
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ