[][Kernel][hnat][Fix hook drop packet]

[Description]
Fix hook drop normal packet
In some cases, the packet match the to the logic
of eth->wlan of the legacy chip(mt7621).
After failing to find the interface,
it will be discarded by the hnat function.
Here packets should be handed over to the kernel

[Release-log]
N/A


Change-Id: Idca4c6e899e743c89fbcb562f2695a77b02a98af
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7265953
diff --git a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
index d2e09e2..16cbed3 100644
--- a/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
+++ b/target/linux/mediatek/files-5.4/drivers/net/ethernet/mediatek/mtk_hnat/hnat_nf_hook.c
@@ -494,7 +494,14 @@
 	else
 		index = entry->ipv6_5t_route.act_dp;
 
-	skb->dev = get_dev_from_index(index);
+	dev = get_dev_from_index(index);
+	if (!dev) {
+		trace_printk("%s: called from %s. Get wifi interface fail\n",
+			     __func__, func);
+		return 0;
+	}
+
+	skb->dev = dev;
 
 	if (IS_HQOS_MODE && eth_hdr(skb)->h_proto == HQOS_MAGIC_TAG) {
 		skb = skb_unshare(skb, GFP_ATOMIC);