commit | 9d17aad4ec26799d8576cb6af70f0e6231044d1b | [log] [tgz] |
---|---|---|
author | developer <developer@mediatek.com> | Thu Aug 01 17:36:15 2024 +0800 |
committer | developer <developer@mediatek.com> | Thu Aug 08 11:21:02 2024 +0800 |
tree | 6820d6b6a49ebd93e3c4d3b845017ce587899695 | |
parent | 704dba3a1219787199e2f9cfa7771ec6a118271c [diff] [blame] |
[][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;