Skip to contentSkip to conversation

examples/ipsec_secgw: fix security session

PATCH Applied Fan Zhang 3 participants 3 messages Jan 23, 2018

lore
Share & tools
lore

Fan Zhang

author
#0 lore raw

PATCH 1/1 examples/ipsec_secgw: fix security session

Fixes 3da37f682173 ("examples/ipsec_secgw: create session mempools for ethdevs")

Some NICs do not have the rte_security context, this patch fixes the segment fault caused by this.

---
 examples/ipsec-secgw/ipsec-secgw.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
examples/ipsec-secgw/ipsec-secgw.c +8 -2
index 3a28fcceb..c67f79db9 100644
@@ -1384,10 +1384,16 @@ cryptodevs_init(void)
 			max_sess_sz = sess_sz;
 	}
 	for (port_id = 0; port_id < rte_eth_dev_count(); port_id++) {
+		void *sec_ctx;
+
 		if ((enabled_port_mask & (1 << port_id)) == 0)
 			continue;
-		sess_sz = rte_security_session_get_size(
-				rte_eth_dev_get_sec_ctx(port_id));
+
+		sec_ctx = rte_eth_dev_get_sec_ctx(port_id);
+		if (sec_ctx == NULL)
+			continue;
+
+		sess_sz = rte_security_session_get_size(sec_ctx);
 		if (sess_sz > max_sess_sz)
 			max_sess_sz = sess_sz;
 	}
Signature · 1 line
2.13.6
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Fan Zhang
Sent: Tuesday, January 23, 2018 12:32 PM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>
Subject: [dpdk-dev] [PATCH] examples/ipsec_secgw: fix security session

Quoted 7 lines
Fixes 3da37f682173 ("examples/ipsec_secgw: create session mempools for

ethdevs")

Some NICs do not have the rte_security context, this patch fixes the segment fault caused by this.

#2 lore raw
Quoted 21 lines

-----Original Message-----
From: Nicolau, Radu
Sent: Tuesday, January 23, 2018 3:05 PM
To: Zhang, Roy Fan <[email protected]>; [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>
Subject: RE: [dpdk-dev] [PATCH] examples/ipsec_secgw: fix security session

Quoted 11 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Fan Zhang
Sent: Tuesday, January 23, 2018 12:32 PM
To: [email protected]
Cc: De Lara Guarch, Pablo <[email protected]>
Subject: [dpdk-dev] [PATCH] examples/ipsec_secgw: fix security session

Fixes 3da37f682173 ("examples/ipsec_secgw: create session mempools

for
ethdevs")

Quoted 6 lines
Quoted 4 lines

Some NICs do not have the rte_security context, this patch fixes the segment fault caused by this.

Applied to dpdk-next-crypto.
Thanks,

Pablo