1
linux/drivers/net/ethernet/freescale
Wei Fang e15c5506dd net: enetc: allocate vf_state during PF probes
In the previous implementation, vf_state is allocated memory only when VF
is enabled. However, net_device_ops::ndo_set_vf_mac() may be called before
VF is enabled to configure the MAC address of VF. If this is the case,
enetc_pf_set_vf_mac() will access vf_state, resulting in access to a null
pointer. The simplified error log is as follows.

root@ls1028ardb:~# ip link set eno0 vf 1 mac 00:0c:e7:66:77:89
[  173.543315] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000004
[  173.637254] pc : enetc_pf_set_vf_mac+0x3c/0x80 Message from sy
[  173.641973] lr : do_setlink+0x4a8/0xec8
[  173.732292] Call trace:
[  173.734740]  enetc_pf_set_vf_mac+0x3c/0x80
[  173.738847]  __rtnl_newlink+0x530/0x89c
[  173.742692]  rtnl_newlink+0x50/0x7c
[  173.746189]  rtnetlink_rcv_msg+0x128/0x390
[  173.750298]  netlink_rcv_skb+0x60/0x130
[  173.754145]  rtnetlink_rcv+0x18/0x24
[  173.757731]  netlink_unicast+0x318/0x380
[  173.761665]  netlink_sendmsg+0x17c/0x3c8

Fixes: d4fd0404c1 ("enetc: Introduce basic PF and VF ENETC ethernet drivers")
Signed-off-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Link: https://patch.msgid.link/20241031060247.1290941-2-wei.fang@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-11-03 12:50:53 -08:00
..
dpaa net: dpaa_eth: print FD status in CPU endianness in dpaa_eth_fd tracepoint 2024-10-31 19:18:46 -07:00
dpaa2 netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
enetc net: enetc: allocate vf_state during PF probes 2024-11-03 12:50:53 -08:00
fman fsl/fman: Fix refcount handling of fman-related devices 2024-10-21 10:50:16 +02:00
fs_enet net: ethernet: fs_enet: Make the per clock optional 2024-09-15 08:29:30 -07:00
fec_main.c net: fec: don't save PTP state if PTP is unsupported 2024-10-09 19:37:55 -07:00
fec_mpc52xx_phy.c
fec_mpc52xx.c
fec_mpc52xx.h
fec_ptp.c net: fec: Reload PTP registers after link-state change 2024-10-01 11:21:12 +02:00
fec.h net: fec: Reload PTP registers after link-state change 2024-10-01 11:21:12 +02:00
fsl_pq_mdio.c
gianfar_ethtool.c gianfar: Remove setting of RX software timestamp 2024-09-03 15:17:49 -07:00
gianfar.c net: gianfar: fix NVMEM mac address 2024-09-11 16:03:14 -07:00
gianfar.h
Kconfig
Makefile
ucc_geth_ethtool.c
ucc_geth.c
ucc_geth.h
xgmac_mdio.c