[][Kernel][mt7986][hnat][Add processing of unexpected skb]

[Description]
Add processing of uninitialized mac header skb in HNAT to avoid crash.

[Release-log]
N/A


Change-Id: I7915ab5cb9c366728b70a6597ba06cb6f984e4a8
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/6887447
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 18c0324..d2e09e2 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
@@ -1739,6 +1739,9 @@
 	    (gmac_no != NR_WHNAT_WDMA_PORT))
 		return NF_ACCEPT;
 
+	if (unlikely(!skb_mac_header_was_set(skb)))
+		return NF_ACCEPT;
+
 	if (!skb_hnat_is_hashed(skb))
 		return NF_ACCEPT;
 
@@ -2118,6 +2121,9 @@
 					  !IS_SPACE_AVAILABLE_HEAD(skb)))
 		return 0;
 
+	if (unlikely(!skb_mac_header_was_set(skb)))
+		return 0;
+
 	if (unlikely(!skb_hnat_is_hashed(skb)))
 		return 0;