diff options
author | Petr Štetiar <ynezz@true.cz> | 2020-03-16 09:43:00 +0100 |
---|---|---|
committer | Petr Štetiar <ynezz@true.cz> | 2020-03-16 22:21:45 +0100 |
commit | f521ef5ff3110018fb8b4e6827e2a5d7f32c41f0 (patch) | |
tree | 8d0c18ee8d8e879d743bbccdbae5e971b9fd5d5d | |
parent | cf74e2d4fdcc3b270612c942e20cf23e260823ff (diff) | |
download | upstream-f521ef5ff3110018fb8b4e6827e2a5d7f32c41f0.tar.gz upstream-f521ef5ff3110018fb8b4e6827e2a5d7f32c41f0.tar.bz2 upstream-f521ef5ff3110018fb8b4e6827e2a5d7f32c41f0.zip |
ipq40xx: 5.4: fix of_get_mac_address obsolete usage OOPs
of_get_mac_address returns valid pointer or ERR_PTR since 5.2 via commit
d01f449c008a ("of_net: add NVMEM support to of_get_mac_address") so the
patch fixes following OOPs on nbg6617:
Unable to handle kernel paging request at virtual address ffffffed
CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.4.24 #0
PC is at edma_axi_probe+0x444/0x1114
LR is at bus_find_device+0x88/0x9c
Where the PC can be resolved to:
>>> l *edma_axi_probe+0x444
0xc067be5c is in edma_axi_probe (./include/linux/string.h:378).
>>> l *edma_axi_probe+0x43f
0xc067be57 is in edma_axi_probe (drivers/net/ethernet/qualcomm/essedma/edma_axi.c:936)
Which leads to the following code fragment:
935 mac_addr = of_get_mac_address(pnp);
936 if (mac_addr)
937 memcpy(edma_netdev[idx_mac]->dev_addr, mac_addr, ETH_ALEN);
Where using mac_addr=0xffffffed (-ENODEV) as source address in memcpy()
is causing the OOPs.
Acked-by: John Crispin <john@phrozen.org>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
-rw-r--r-- | target/linux/ipq40xx/files-5.4/drivers/net/ethernet/qualcomm/essedma/edma_axi.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/target/linux/ipq40xx/files-5.4/drivers/net/ethernet/qualcomm/essedma/edma_axi.c b/target/linux/ipq40xx/files-5.4/drivers/net/ethernet/qualcomm/essedma/edma_axi.c index db5eac2f03..b619bbbab9 100644 --- a/target/linux/ipq40xx/files-5.4/drivers/net/ethernet/qualcomm/essedma/edma_axi.c +++ b/target/linux/ipq40xx/files-5.4/drivers/net/ethernet/qualcomm/essedma/edma_axi.c @@ -933,7 +933,7 @@ static int edma_axi_probe(struct platform_device *pdev) } mac_addr = of_get_mac_address(pnp); - if (mac_addr) + if (!IS_ERR(mac_addr)) memcpy(edma_netdev[idx_mac]->dev_addr, mac_addr, ETH_ALEN); idx_mac++; |