crypto/octeontx2: fix IPsec session member overlap
authorAnoob Joseph <anoobj@marvell.com>
Tue, 13 Jul 2021 10:27:06 +0000 (15:57 +0530)
committerAkhil Goyal <gakhil@marvell.com>
Tue, 20 Jul 2021 08:32:05 +0000 (10:32 +0200)
The member 'dir' should not overlap with 'ip'. Usage of union for all
members would mean dir would get corrupt.

Fixes: e91b4f45ff54 ("net/octeontx2: support anti-replay for security session")
Cc: stable@dpdk.org
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
drivers/crypto/octeontx2/otx2_security.h

index 9f1ba71..29c8fc3 100644 (file)
 #define OTX2_SEC_AES_GCM_ROUNDUP_BYTE_LEN      4
 #define OTX2_SEC_AES_CBC_ROUNDUP_BYTE_LEN      16
 
-union otx2_sec_session_ipsec {
-       struct otx2_sec_session_ipsec_ip ip;
-       struct otx2_sec_session_ipsec_lp lp;
+struct otx2_sec_session_ipsec {
+       union {
+               struct otx2_sec_session_ipsec_ip ip;
+               struct otx2_sec_session_ipsec_lp lp;
+       };
        enum rte_security_ipsec_sa_direction dir;
 };
 
 struct otx2_sec_session {
-       union otx2_sec_session_ipsec ipsec;
+       struct otx2_sec_session_ipsec ipsec;
        void *userdata;
        /**< Userdata registered by the application */
 } __rte_cache_aligned;