[][Add sanity check to bypass invalid packet]

[Description]
Add sanity check to avoid processing invalid packet for NF_HNAT.

[Release-log]
N/A

Change-Id: I5330205d61f31b761f2c9c0f76258cabceaccd31
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/4627575
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 1fb7ad2..73fe7af 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
@@ -634,7 +634,8 @@
 	struct iphdr _iphdr;
 
 	eth = eth_hdr(skb);
-	if (is_broadcast_ether_addr(eth->h_dest))
+	if (!is_magic_tag_valid(skb) || !IS_SPACE_AVAILABLE_HEAD(skb) ||
+	    is_broadcast_ether_addr(eth->h_dest))
 		return 0;
 
 	switch (ntohs(skb->protocol)) {