Skip to contentSkip to conversation

net: sxgbe: Fix NULL dereferece when using DT

PATCH Applied Kukjin Kim 2 participants 2 messages Jan 15, 2015 – Jan 16, 2015

Subsystems (3)
lore
Share & tools
lore

Kukjin Kim

author
#0 lore raw

PATCH 1/1 net: sxgbe: Fix NULL dereferece when using DT

From: Girish K.S <[email protected]>

When the MAC address is provided in the device tree file, the condition is true and kernel crashes due to NULL dereference.

---
 drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c +4 -4
index 866560e..b02eed1 100644
@@ -108,10 +108,6 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
 		}
 	}
 
-	/* Get MAC address if available (DT) */
-	if (mac)
-		ether_addr_copy(priv->dev->dev_addr, mac);
-
 	priv = sxgbe_drv_probe(&(pdev->dev), plat_dat, addr);
 	if (!priv) {
 		pr_err("%s: main driver probe failed\n", __func__);
@@ -125,6 +121,10 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
 		goto err_drv_remove;
 	}
 
+	/* Get MAC address if available (DT) */
+	if (mac)
+		ether_addr_copy(priv->dev->dev_addr, mac);
+
 	/* Get the TX/RX IRQ numbers */
 	for (i = 0, chan = 1; i < SXGBE_TX_QUEUES; i++) {
 		priv->txq[i]->irq_no = irq_of_parse_and_map(node, chan++);
Signature · 1 line
2.0.0