Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: ethernet: mtk_eth_soc: fix NULL pointer dereference

Check for NULL pointer to avoid kernel crashing in case of missing WO
firmware in case only a single WEDv2 device has been initialized, e.g. on
MT7981 which can connect just one wireless frontend.

Fixes: 86ce0d09e424 ("net: ethernet: mtk_eth_soc: use WO firmware for MT7981")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Daniel Golle and committed by
David S. Miller
7c83e28f 582dbb2c

+1 -1
+1 -1
drivers/net/ethernet/mediatek/mtk_wed.c
··· 654 654 BIT(hw->index), BIT(hw->index)); 655 655 } 656 656 657 - if (!hw_list[!hw->index]->wed_dev && 657 + if ((!hw_list[!hw->index] || !hw_list[!hw->index]->wed_dev) && 658 658 hw->eth->dma_dev != hw->eth->dev) 659 659 mtk_eth_set_dma_device(hw->eth, hw->eth->dev); 660 660