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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240307085135.16245-1-amishin@t-argos.ru>
Date: Thu, 7 Mar 2024 11:51:35 +0300
From: Aleksandr Mishin <amishin@...rgos.ru>
To: Jaehoon Chung <jh80.chung@...sung.com>
CC: Aleksandr Mishin <amishin@...rgos.ru>, Ulf Hansson
	<ulf.hansson@...aro.org>, Wen Zhiwei <wenzhiwei@...inos.cn>,
	<linux-mmc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<lvc-project@...uxtesting.org>
Subject: [PATCH] mmc: dw_mmc: Fix potential null pointer risk

In dw_mci_runtime_resume() 'host->slot' could be null, but check is not cover all corresponding code.
Fix this bug by changing check place.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 4a835afd808a (mmc: dw_mmc: Fix potential null pointer risk)
Signed-off-by: Aleksandr Mishin <amishin@...rgos.ru>
---
 drivers/mmc/host/dw_mmc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 829af2c98a44..a4f124452abc 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -3570,8 +3570,10 @@ int dw_mci_runtime_resume(struct device *dev)
 		   DW_MCI_ERROR_FLAGS);
 	mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE);
 
+	if (!host->slot)
+		goto err;
 
-	if (host->slot && host->slot->mmc->pm_flags & MMC_PM_KEEP_POWER)
+	if (host->slot->mmc->pm_flags & MMC_PM_KEEP_POWER)
 		dw_mci_set_ios(host->slot->mmc, &host->slot->mmc->ios);
 
 	/* Force setup bus to guarantee available clock output */
-- 
2.30.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ