Skip to contentSkip to conversation

macsec: fix validation failed in asynchronous operation.

PATCH Superseded Ryder Lee 2 participants 2 messages Feb 20, 2017

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Ryder Lee

author
#0 lore raw

PATCH 1/1 macsec: fix validation failed in asynchronous operation.

MACSec test failed when asynchronous crypto operations is used. It encounters packet validation failed since macsec_skb_cb(skb)->valid is always 'false'.

This patch adds missing "macsec_skb_cb(skb)->valid = true" in macsec_decrypt_done() when "err == 0".

---
Changes since v1:
- add "err == 0" to check decrypt status

 drivers/net/macsec.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/macsec.c +3 -0
index f83cf66..96b154e 100644
@@ -879,6 +879,9 @@ static void macsec_decrypt_done(struct crypto_async_request *base, int err)
 
 	aead_request_free(macsec_skb_cb(skb)->req);
 
+	if (err == 0)
+	 macsec_skb_cb(skb)->valid = true;
+
 	rcu_read_lock_bh();
 	pn = ntohl(macsec_ethhdr(skb)->packet_number);
 	if (!macsec_post_decrypt(skb, &macsec->secy, pn)) {
Signature · 1 line
1.9.1
maintainer
#1 lore raw

From: Ryder Lee <[email protected]>
Date: Mon, 20 Feb 2017 18:32:30 +0800

drivers/net/macsec.c static void macsec_decrypt_done(struct crypto_async_request *base, int err) · line 884

Quoted 7 lines
drivers/net/macsec.c +3 -0
@@ -879,6 +879,9 @@ static void macsec_decrypt_done(struct crypto_async_request *base, int err)
 
 	aead_request_free(macsec_skb_cb(skb)->req);
 
+	if (err == 0)
+	 macsec_skb_cb(skb)->valid = true;
+

This is not indented properly, please use TABs like the rest of the code does. And the canonical way to test against zero is "if (!err)"