summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/sunplus
diff options
context:
space:
mode:
authorZheng Wang <zyytlz.wz@163.com>2022-09-30 19:57:25 +0200
committerDavid S. Miller <davem@davemloft.net>2022-10-03 13:47:42 +0200
commit12aece8b01507a2d357a1861f470e83621fbb6f2 (patch)
treebb9bc5292f1be8f5ea9513c2ba198c481e905968 /drivers/net/ethernet/sunplus
parentbnx2x: fix potential memory leak in bnx2x_tpa_stop() (diff)
downloadlinux-12aece8b01507a2d357a1861f470e83621fbb6f2.tar.xz
linux-12aece8b01507a2d357a1861f470e83621fbb6f2.zip
eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address
This frees "mac" and tries to display its address as part of the error message on the next line. Swap the order. Fixes: fd3040b9394c ("net: ethernet: Add driver for Sunplus SP7021") Signed-off-by: Zheng Wang <zyytlz.wz@163.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/sunplus')
-rw-r--r--drivers/net/ethernet/sunplus/spl2sw_driver.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ethernet/sunplus/spl2sw_driver.c b/drivers/net/ethernet/sunplus/spl2sw_driver.c
index 546206640492..61d1d07dc070 100644
--- a/drivers/net/ethernet/sunplus/spl2sw_driver.c
+++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c
@@ -248,8 +248,8 @@ static int spl2sw_nvmem_get_mac_address(struct device *dev, struct device_node *
/* Check if mac address is valid */
if (!is_valid_ether_addr(mac)) {
- kfree(mac);
dev_info(dev, "Invalid mac address in nvmem (%pM)!\n", mac);
+ kfree(mac);
return -EINVAL;
}