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: <20200714022304.4003-1-vulab@iscas.ac.cn>
Date:   Tue, 14 Jul 2020 02:23:04 +0000
From:   Xu Wang <vulab@...as.ac.cn>
To:     davem@...emloft.net, kuba@...nel.org, michal.simek@...inx.com,
        esben@...nix.com, hkallweit1@...il.com, f.fainelli@...il.com,
        vulab@...as.ac.cn, weiyongjun1@...wei.com, netdev@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org
Cc:     linux-kernel@...r.kernel.org
Subject: [PATCH] net: xilinx: fix potential NULL dereference in temac_probe()

platform_get_resource() may return NULL, add proper
check to avoid potential NULL dereferencing.

Signed-off-by: Xu Wang <vulab@...as.ac.cn>
---
 drivers/net/ethernet/xilinx/ll_temac_main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 929244064abd..85a767fa2ecf 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -1408,6 +1408,8 @@ static int temac_probe(struct platform_device *pdev)
 
 	/* map device registers */
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!res)
+		return -EINVAL;
 	lp->regs = devm_ioremap(&pdev->dev, res->start,
 					resource_size(res));
 	if (!lp->regs) {
@@ -1503,6 +1505,8 @@ static int temac_probe(struct platform_device *pdev)
 	} else if (pdata) {
 		/* 2nd memory resource specifies DMA registers */
 		res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+		if (!res)
+			return -EINVAL;
 		lp->sdma_regs = devm_ioremap(&pdev->dev, res->start,
 						     resource_size(res));
 		if (!lp->sdma_regs) {
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ