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: <20220506094039.3629649-1-yangyingliang@huawei.com>
Date:   Fri, 6 May 2022 17:40:39 +0800
From:   Yang Yingliang <yangyingliang@...wei.com>
To:     <linux-kernel@...r.kernel.org>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-stm32@...md-mailman.stormreply.com>,
        <netdev@...r.kernel.org>
CC:     <peppe.cavallaro@...com>, <alexandre.torgue@...s.st.com>,
        <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>
Subject: [PATCH] net: stmmac: fix missing pci_disable_device() on error in stmmac_pci_probe()

Fix the missing pci_disable_device() before return
from stmmac_pci_probe() in the error handling case.

Reported-by: Hulk Robot <hulkci@...wei.com>
Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index fcf17d8a0494..02bddc05a34f 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -194,7 +194,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
 			continue;
 		ret = pcim_iomap_regions(pdev, BIT(i), pci_name(pdev));
 		if (ret)
-			return ret;
+			goto err_out_disable_device;
 		break;
 	}
 
@@ -202,7 +202,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
 
 	ret = info->setup(pdev, plat);
 	if (ret)
-		return ret;
+		goto err_out_disable_device;
 
 	memset(&res, 0, sizeof(res));
 	res.addr = pcim_iomap_table(pdev)[i];
@@ -219,7 +219,16 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
 	plat->safety_feat_cfg->prtyen = 1;
 	plat->safety_feat_cfg->tmouten = 1;
 
-	return stmmac_dvr_probe(&pdev->dev, plat, &res);
+	ret = stmmac_dvr_probe(&pdev->dev, plat, &res);
+	if (ret)
+		goto err_out_disable_device;
+
+	return 0;
+
+err_out_disable_device:
+	pci_disable_device(pdev);
+
+	return ret;
 }
 
 /**
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ