net: wangxun: fix kernel panic due to null pointer
authorJiawen Wu <jiawenwu@trustnetic.com>
Fri, 17 Nov 2023 10:11:08 +0000 (18:11 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 3 Dec 2023 06:33:03 +0000 (07:33 +0100)
commit61a55071653974dab172d4c5d699bb365cfd13c9
tree8c123734da2d0937fa39d32cb8ec1f6343292edd
parentd6569fecd6b3ed9344c3a59a4f3086595c903a39
net: wangxun: fix kernel panic due to null pointer

[ Upstream commit 8ba2c459668cfe2aaacc5ebcd35b4b9ef8643013 ]

When the device uses a custom subsystem vendor ID, the function
wx_sw_init() returns before the memory of 'wx->mac_table' is allocated.
The null pointer will causes the kernel panic.

Fixes: 79625f45ca73 ("net: wangxun: Move MAC address handling to libwx")
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/wangxun/libwx/wx_hw.c
drivers/net/ethernet/wangxun/ngbe/ngbe_main.c
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c