public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH wireless-next] wifi: mac80211: fix AEAD functions not handling errors
@ 2026-03-23 21:15 Miri Korenblit
  2026-03-24  6:36 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Miri Korenblit @ 2026-03-23 21:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: Emmanuel Grumbach, Johannes Berg

From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>

This was done for CMAC but not for AEAD.
This was spotted by Coverity.

Fixes: 26717828b75d ("mac80211: aes-cmac: switch to shash CMAC driver")
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 net/mac80211/fils_aead.c | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/net/mac80211/fils_aead.c b/net/mac80211/fils_aead.c
index 912c46f74d24..a24c0d0a2b2a 100644
--- a/net/mac80211/fils_aead.c
+++ b/net/mac80211/fils_aead.c
@@ -28,25 +28,35 @@ static int aes_s2v(struct crypto_shash *tfm,
 	u8 d[AES_BLOCK_SIZE], tmp[AES_BLOCK_SIZE] = {};
 	SHASH_DESC_ON_STACK(desc, tfm);
 	size_t i;
+	int err;
 
 	desc->tfm = tfm;
 
 	/* D = AES-CMAC(K, <zero>) */
-	crypto_shash_digest(desc, tmp, AES_BLOCK_SIZE, d);
+	err = crypto_shash_digest(desc, tmp, AES_BLOCK_SIZE, d);
+	if (err)
+		return err;
 
 	for (i = 0; i < num_elem - 1; i++) {
 		/* D = dbl(D) xor AES_CMAC(K, Si) */
 		gf_mulx(d); /* dbl */
-		crypto_shash_digest(desc, addr[i], len[i], tmp);
+		err = crypto_shash_digest(desc, addr[i], len[i], tmp);
+		if (err)
+			return err;
 		crypto_xor(d, tmp, AES_BLOCK_SIZE);
 	}
 
-	crypto_shash_init(desc);
+	err = crypto_shash_init(desc);
+	if (err)
+		return err;
 
 	if (len[i] >= AES_BLOCK_SIZE) {
 		/* len(Sn) >= 128 */
 		/* T = Sn xorend D */
-		crypto_shash_update(desc, addr[i], len[i] - AES_BLOCK_SIZE);
+		err = crypto_shash_update(desc, addr[i],
+					  len[i] - AES_BLOCK_SIZE);
+		if (err)
+			return err;
 		crypto_xor(d, addr[i] + len[i] - AES_BLOCK_SIZE,
 			   AES_BLOCK_SIZE);
 	} else {
@@ -57,9 +67,7 @@ static int aes_s2v(struct crypto_shash *tfm,
 		d[len[i]] ^= 0x80;
 	}
 	/* V = AES-CMAC(K, T) */
-	crypto_shash_finup(desc, d, AES_BLOCK_SIZE, v);
-
-	return 0;
+	return crypto_shash_finup(desc, d, AES_BLOCK_SIZE, v);
 }
 
 /* Note: addr[] and len[] needs to have one extra slot at the end. */
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH wireless-next] wifi: mac80211: fix AEAD functions not handling errors
  2026-03-23 21:15 [PATCH wireless-next] wifi: mac80211: fix AEAD functions not handling errors Miri Korenblit
@ 2026-03-24  6:36 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2026-03-24  6:36 UTC (permalink / raw)
  To: Miri Korenblit, linux-wireless; +Cc: Emmanuel Grumbach

On Mon, 2026-03-23 at 23:15 +0200, Miri Korenblit wrote:
> From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> 
> This was done for CMAC but not for AEAD.
> This was spotted by Coverity.

I'm not going to apply this, given that this is all refactored (and the
bug removed) in -next:

https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/commit/?h=libcrypto-next&id=5e07ce466356d9833757b2d6c0380b6ee7b11a77

johannes

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-24  6:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23 21:15 [PATCH wireless-next] wifi: mac80211: fix AEAD functions not handling errors Miri Korenblit
2026-03-24  6:36 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox