[][openwrt][mt7988][crypto][Add checking xfrm state info to avoid null pointer]

[Description]
Add checking xfrm state info to avoid null pointer.

[Release-log]
N/A


Change-Id: I1fab1b13b52dbc59d7e9ce9083541af014998b0e
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/9437494
diff --git a/feed/kernel/crypto-eip/src/ddk-wrapper.c b/feed/kernel/crypto-eip/src/ddk-wrapper.c
index ffc0df1..43bb138 100644
--- a/feed/kernel/crypto-eip/src/ddk-wrapper.c
+++ b/feed/kernel/crypto-eip/src/ddk-wrapper.c
@@ -2081,6 +2081,13 @@
 		return (u32 *) sa_handle.p;
 	}
 
+	/* Check algorithm exist in xfrm state*/
+	if (!xs->ealg || !xs->aalg) {
+		CRYPTO_ERR("NULL algorithm in xfrm state\n");
+		sa_handle.p = NULL;
+		return (u32 *) sa_handle.p;
+	}
+
 	/* Add crypto key and parameters */
 	params.CryptoAlgo = set_crypto_algo(xs->ealg);
 	params.CryptoMode = SAB_CRYPTO_MODE_CBC;