Skip to content

Commit 7c83e28

Browse files
dangowrtdavem330
authored andcommitted
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: 86ce0d0 ("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>
1 parent 582dbb2 commit 7c83e28

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/net/ethernet/mediatek/mtk_wed.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@ __mtk_wed_detach(struct mtk_wed_device *dev)
654654
BIT(hw->index), BIT(hw->index));
655655
}
656656

657-
if (!hw_list[!hw->index]->wed_dev &&
657+
if ((!hw_list[!hw->index] || !hw_list[!hw->index]->wed_dev) &&
658658
hw->eth->dma_dev != hw->eth->dev)
659659
mtk_eth_set_dma_device(hw->eth, hw->eth->dev);
660660

0 commit comments

Comments
 (0)