diff options
author | Daniel Phan <daniel.phan36@gmail.com> | 2021-03-09 12:41:36 -0800 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2021-03-16 21:20:41 +0100 |
commit | 58d25626f6f0ea5bcec3c13387b9f835d188723d (patch) | |
tree | 256b1998b86fe2e441b9d0e035b3048a10698386 /net/mac80211/aes_gmac.c | |
parent | 0f7e90faddeef53a3568f449a0c3992d77510b66 (diff) | |
download | lwn-58d25626f6f0ea5bcec3c13387b9f835d188723d.tar.gz lwn-58d25626f6f0ea5bcec3c13387b9f835d188723d.zip |
mac80211: Check crypto_aead_encrypt for errors
crypto_aead_encrypt returns <0 on error, so if these calls are not checked,
execution may continue with failed encrypts. It also seems that these two
crypto_aead_encrypt calls are the only instances in the codebase that are
not checked for errors.
Signed-off-by: Daniel Phan <daniel.phan36@gmail.com>
Link: https://lore.kernel.org/r/20210309204137.823268-1-daniel.phan36@gmail.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/aes_gmac.c')
-rw-r--r-- | net/mac80211/aes_gmac.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/mac80211/aes_gmac.c b/net/mac80211/aes_gmac.c index 6f3b3a0cc10a..512cab073f2e 100644 --- a/net/mac80211/aes_gmac.c +++ b/net/mac80211/aes_gmac.c @@ -22,6 +22,7 @@ int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce, struct aead_request *aead_req; int reqsize = sizeof(*aead_req) + crypto_aead_reqsize(tfm); const __le16 *fc; + int ret; if (data_len < GMAC_MIC_LEN) return -EINVAL; @@ -59,10 +60,10 @@ int ieee80211_aes_gmac(struct crypto_aead *tfm, const u8 *aad, u8 *nonce, aead_request_set_crypt(aead_req, sg, sg, 0, iv); aead_request_set_ad(aead_req, GMAC_AAD_LEN + data_len); - crypto_aead_encrypt(aead_req); + ret = crypto_aead_encrypt(aead_req); kfree_sensitive(aead_req); - return 0; + return ret; } struct crypto_aead *ieee80211_aes_gmac_key_setup(const u8 key[], |