[3/3] net/txgbe: fix security session destroy

Message ID 20221013121913.3543260-3-radu.nicolau@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series [1/3] net/iavf: fix security session destroy |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/intel-Testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS

Commit Message

Radu Nicolau Oct. 13, 2022, 12:19 p.m. UTC
  Replace mempool_put with memset 0, the internal session memory block
is no longer allocated from a mempool

Fixes: 3f3fc3308bd0 ("security: remove private mempool usage")
Cc: gakhil@marvell.com

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
---
 drivers/net/txgbe/txgbe_ipsec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Akhil Goyal Oct. 13, 2022, 12:23 p.m. UTC | #1
> Replace mempool_put with memset 0, the internal session memory block
> is no longer allocated from a mempool
> 
> Fixes: 3f3fc3308bd0 ("security: remove private mempool usage")
> Cc: gakhil@marvell.com
> 
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
  
Jiawen Wu Oct. 14, 2022, 9:58 a.m. UTC | #2
On Thursday, October 13, 2022 8:19 PM, Radu Nicolau wrote:
> Replace mempool_put with memset 0, the internal session memory block is no longer allocated from
> a mempool
> 
> Fixes: 3f3fc3308bd0 ("security: remove private mempool usage")
> Cc: gakhil@marvell.com
> 
> Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> ---
>  drivers/net/txgbe/txgbe_ipsec.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/txgbe/txgbe_ipsec.c b/drivers/net/txgbe/txgbe_ipsec.c index
> b458b3a922..f9f8108fb8 100644
> --- a/drivers/net/txgbe/txgbe_ipsec.c
> +++ b/drivers/net/txgbe/txgbe_ipsec.c
> @@ -409,7 +409,6 @@ txgbe_crypto_remove_session(void *device,  {
>  	struct rte_eth_dev *eth_dev = device;
>  	struct txgbe_crypto_session *ic_session = SECURITY_GET_SESS_PRIV(session);
> -	struct rte_mempool *mempool = rte_mempool_from_obj(ic_session);
> 
>  	if (eth_dev != ic_session->dev) {
>  		PMD_DRV_LOG(ERR, "Session not bound to this device\n"); @@ -421,7 +420,7 @@
> txgbe_crypto_remove_session(void *device,
>  		return -EFAULT;
>  	}
> 
> -	rte_mempool_put(mempool, (void *)ic_session);
> +	memset(ic_session, 0, sizeof(struct txgbe_crypto_session));
> 
>  	return 0;
>  }
> --
> 2.25.1
> 
> 

Reviewed-by: Jiawen Wu <jiawenwu@trustnetic.com>
  
Qi Zhang Oct. 18, 2022, 4:19 a.m. UTC | #3
> -----Original Message-----
> From: Jiawen Wu <jiawenwu@trustnetic.com>
> Sent: Friday, October 14, 2022 5:59 PM
> To: Nicolau, Radu <radu.nicolau@intel.com>; 'Jian Wang'
> <jianwang@trustnetic.com>
> Cc: dev@dpdk.org; gakhil@marvell.com
> Subject: RE: [PATCH 3/3] net/txgbe: fix security session destroy
> 
> On Thursday, October 13, 2022 8:19 PM, Radu Nicolau wrote:
> > Replace mempool_put with memset 0, the internal session memory block
> > is no longer allocated from a mempool
> >
> > Fixes: 3f3fc3308bd0 ("security: remove private mempool usage")
> > Cc: gakhil@marvell.com
> >
> > Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
> > ---
> >  drivers/net/txgbe/txgbe_ipsec.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/txgbe/txgbe_ipsec.c
> > b/drivers/net/txgbe/txgbe_ipsec.c index
> > b458b3a922..f9f8108fb8 100644
> > --- a/drivers/net/txgbe/txgbe_ipsec.c
> > +++ b/drivers/net/txgbe/txgbe_ipsec.c
> > @@ -409,7 +409,6 @@ txgbe_crypto_remove_session(void *device,  {
> >  	struct rte_eth_dev *eth_dev = device;
> >  	struct txgbe_crypto_session *ic_session =
> SECURITY_GET_SESS_PRIV(session);
> > -	struct rte_mempool *mempool =
> rte_mempool_from_obj(ic_session);
> >
> >  	if (eth_dev != ic_session->dev) {
> >  		PMD_DRV_LOG(ERR, "Session not bound to this device\n");
> @@ -421,7
> > +420,7 @@ txgbe_crypto_remove_session(void *device,
> >  		return -EFAULT;
> >  	}
> >
> > -	rte_mempool_put(mempool, (void *)ic_session);
> > +	memset(ic_session, 0, sizeof(struct txgbe_crypto_session));
> >
> >  	return 0;
> >  }
> > --
> > 2.25.1
> >
> >
> 
> Reviewed-by: Jiawen Wu <jiawenwu@trustnetic.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/txgbe/txgbe_ipsec.c b/drivers/net/txgbe/txgbe_ipsec.c
index b458b3a922..f9f8108fb8 100644
--- a/drivers/net/txgbe/txgbe_ipsec.c
+++ b/drivers/net/txgbe/txgbe_ipsec.c
@@ -409,7 +409,6 @@  txgbe_crypto_remove_session(void *device,
 {
 	struct rte_eth_dev *eth_dev = device;
 	struct txgbe_crypto_session *ic_session = SECURITY_GET_SESS_PRIV(session);
-	struct rte_mempool *mempool = rte_mempool_from_obj(ic_session);
 
 	if (eth_dev != ic_session->dev) {
 		PMD_DRV_LOG(ERR, "Session not bound to this device\n");
@@ -421,7 +420,7 @@  txgbe_crypto_remove_session(void *device,
 		return -EFAULT;
 	}
 
-	rte_mempool_put(mempool, (void *)ic_session);
+	memset(ic_session, 0, sizeof(struct txgbe_crypto_session));
 
 	return 0;
 }