[Description]

Fix refcount underflow issue in the pending_work.

If one of the Ethernet interface is down, the pending_work should not
call to mtk_stop() function again to avoid a refcount underflow.

Without this patch, the ETH may experience the kernel panic which
caused by a refcount underflow.

[Release-log]
N/A

Change-Id: I4e1f40640c09372cddad57994da03f70107f133a
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/8324564
This commit is contained in:
developer 2023-12-01 09:08:07 +08:00 committed by hanwckf
parent e45c4d4371
commit e66d976488

View File

@ -3088,7 +3088,7 @@ static void mtk_pending_work(struct work_struct *work)
pr_info("[%s] mtk_stop starts !\n", __func__);
/* stop all devices to make sure that dma is properly shut down */
for (i = 0; i < MTK_MAC_COUNT; i++) {
if (!eth->netdev[i])
if (!eth->netdev[i] || !netif_running(eth->netdev[i]))
continue;
mtk_stop(eth->netdev[i]);
__set_bit(i, &restart);