net/cnxk: fix deadlock in security session creation

Message ID 20230105135718.4162914-1-david.marchand@redhat.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series net/cnxk: fix deadlock in security session creation |

Checks

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

Commit Message

David Marchand Jan. 5, 2023, 1:57 p.m. UTC
  Releasing the lock was missing in this branch.

Fixes: 4440eb88ddfc ("net/cnxk: use full context IPsec structures")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/net/cnxk/cn9k_ethdev_sec.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Zhang, Fan Jan. 5, 2023, 2:04 p.m. UTC | #1
On 1/5/2023 1:57 PM, David Marchand wrote:
> Releasing the lock was missing in this branch.
>
> Fixes: 4440eb88ddfc ("net/cnxk: use full context IPsec structures")
> Cc: stable@dpdk.org
>
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
>   drivers/net/cnxk/cn9k_ethdev_sec.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/cnxk/cn9k_ethdev_sec.c b/drivers/net/cnxk/cn9k_ethdev_sec.c
> index 67966a4e49..327f221e38 100644
> --- a/drivers/net/cnxk/cn9k_ethdev_sec.c
> +++ b/drivers/net/cnxk/cn9k_ethdev_sec.c
> @@ -556,6 +556,7 @@ cn9k_eth_sec_session_create(void *device,
>   
>   	if (!dev->outb.lf_base) {
>   		plt_err("Could not allocate security session private data");
> +		rte_spinlock_unlock(lock);
>   		return -ENOMEM;
>   	}
>   
Acked-by: Fan Zhang <fanzhang.oss@gmail.com>
  
Nithin Dabilpuram Jan. 5, 2023, 2:52 p.m. UTC | #2
> -----Original Message-----
> From: Zhang, Fan <fanzhang.oss@gmail.com>
> Sent: Thursday, January 5, 2023 7:35 PM
> To: David Marchand <david.marchand@redhat.com>; dev@dpdk.org
> Cc: stable@dpdk.org; Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar
> Kokkilagadda <kirankumark@marvell.com>; Sunil Kumar Kori <skori@marvell.com>; Satha
> Koteswara Rao Kottidi <skoteshwar@marvell.com>; Vidya Sagar Velumuri
> <vvelumuri@marvell.com>
> Subject: [EXT] Re: [PATCH] net/cnxk: fix deadlock in security session creation
> 
> External Email
> 
> ----------------------------------------------------------------------
> 
> On 1/5/2023 1:57 PM, David Marchand wrote:
> > Releasing the lock was missing in this branch.
> >
> > Fixes: 4440eb88ddfc ("net/cnxk: use full context IPsec structures")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> >   drivers/net/cnxk/cn9k_ethdev_sec.c | 1 +
> >   1 file changed, 1 insertion(+)
> >
> > diff --git a/drivers/net/cnxk/cn9k_ethdev_sec.c b/drivers/net/cnxk/cn9k_ethdev_sec.c
> > index 67966a4e49..327f221e38 100644
> > --- a/drivers/net/cnxk/cn9k_ethdev_sec.c
> > +++ b/drivers/net/cnxk/cn9k_ethdev_sec.c
> > @@ -556,6 +556,7 @@ cn9k_eth_sec_session_create(void *device,
> >
> >   	if (!dev->outb.lf_base) {
> >   		plt_err("Could not allocate security session private data");
> > +		rte_spinlock_unlock(lock);
> >   		return -ENOMEM;
> >   	}
> >
> Acked-by: Fan Zhang <fanzhang.oss@gmail.com>

Acked-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
  
Jerin Jacob Jan. 11, 2023, 10:44 a.m. UTC | #3
On Thu, Jan 5, 2023 at 8:22 PM Nithin Kumar Dabilpuram
<ndabilpuram@marvell.com> wrote:
>
>
> > -----Original Message-----
> > From: Zhang, Fan <fanzhang.oss@gmail.com>
> > Sent: Thursday, January 5, 2023 7:35 PM
> > To: David Marchand <david.marchand@redhat.com>; dev@dpdk.org
> > Cc: stable@dpdk.org; Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar
> > Kokkilagadda <kirankumark@marvell.com>; Sunil Kumar Kori <skori@marvell.com>; Satha
> > Koteswara Rao Kottidi <skoteshwar@marvell.com>; Vidya Sagar Velumuri
> > <vvelumuri@marvell.com>
> > Subject: [EXT] Re: [PATCH] net/cnxk: fix deadlock in security session creation
> >
> > External Email
> >
> > ----------------------------------------------------------------------
> >
> > On 1/5/2023 1:57 PM, David Marchand wrote:
> > > Releasing the lock was missing in this branch.
> > >
> > > Fixes: 4440eb88ddfc ("net/cnxk: use full context IPsec structures")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > > ---
> > >   drivers/net/cnxk/cn9k_ethdev_sec.c | 1 +
> > >   1 file changed, 1 insertion(+)
> > >
> > > diff --git a/drivers/net/cnxk/cn9k_ethdev_sec.c b/drivers/net/cnxk/cn9k_ethdev_sec.c
> > > index 67966a4e49..327f221e38 100644
> > > --- a/drivers/net/cnxk/cn9k_ethdev_sec.c
> > > +++ b/drivers/net/cnxk/cn9k_ethdev_sec.c
> > > @@ -556,6 +556,7 @@ cn9k_eth_sec_session_create(void *device,
> > >
> > >     if (!dev->outb.lf_base) {
> > >             plt_err("Could not allocate security session private data");
> > > +           rte_spinlock_unlock(lock);
> > >             return -ENOMEM;
> > >     }
> > >
> > Acked-by: Fan Zhang <fanzhang.oss@gmail.com>
>
> Acked-by: Nithin Dabilpuram <ndabilpuram@marvell.com>

Applied to dpdk-next-net-mrvl/for-next-net. Thanks
  

Patch

diff --git a/drivers/net/cnxk/cn9k_ethdev_sec.c b/drivers/net/cnxk/cn9k_ethdev_sec.c
index 67966a4e49..327f221e38 100644
--- a/drivers/net/cnxk/cn9k_ethdev_sec.c
+++ b/drivers/net/cnxk/cn9k_ethdev_sec.c
@@ -556,6 +556,7 @@  cn9k_eth_sec_session_create(void *device,
 
 	if (!dev->outb.lf_base) {
 		plt_err("Could not allocate security session private data");
+		rte_spinlock_unlock(lock);
 		return -ENOMEM;
 	}