net/bnxt: fix missed unlock reported by coverity

Message ID c1ce7c941e28d75d8b1fe140cadcd70a3fdf19c2.1590580273.git.wangyunjian@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers
Series net/bnxt: fix missed unlock reported by coverity |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-nxp-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing warning Testing issues
ci/travis-robot success Travis build: passed

Commit Message

Yunjian Wang May 27, 2020, 12:11 p.m. UTC
From: Yunjian Wang <wangyunjian@huawei.com>

Coverity issue: 357741
Fixes: 02a95625fe9c ("net/bnxt: add flow stats in extended stats")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/bnxt/bnxt_stats.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

Somnath Kotur May 27, 2020, 12:13 p.m. UTC | #1
On Wed, May 27, 2020 at 5:42 PM wangyunjian <wangyunjian@huawei.com> wrote:
>
> From: Yunjian Wang <wangyunjian@huawei.com>
>
> Coverity issue: 357741
> Fixes: 02a95625fe9c ("net/bnxt: add flow stats in extended stats")
> Cc: stable@dpdk.org
>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>  drivers/net/bnxt/bnxt_stats.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
> index cfe193284..8df6922f5 100644
> --- a/drivers/net/bnxt/bnxt_stats.c
> +++ b/drivers/net/bnxt/bnxt_stats.c
> @@ -1008,8 +1008,10 @@ int bnxt_flow_stats_req(struct bnxt *bp)
>                 }
>         }
>
> -       if (!in_flow_tbl_cnt)
> +       if (!in_flow_tbl_cnt) {
> +               bnxt_release_flow_lock(bp);
>                 goto out;
> +       }
>
>         rc = bnxt_update_fc_tbl(bp, counter_type, valid_en_tbl,
>                                 in_flow_tbl_cnt);
> --
> 2.23.0
>
>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
  
Ajit Khaparde May 28, 2020, 1:05 a.m. UTC | #2
On Wed, May 27, 2020 at 5:13 AM Somnath Kotur <somnath.kotur@broadcom.com>
wrote:

> On Wed, May 27, 2020 at 5:42 PM wangyunjian <wangyunjian@huawei.com>
> wrote:
> >
> > From: Yunjian Wang <wangyunjian@huawei.com>
> >
> > Coverity issue: 357741
> > Fixes: 02a95625fe9c ("net/bnxt: add flow stats in extended stats")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
>
Patch applied to dpdk-next-net-brcm. Thanks


> > ---
> >  drivers/net/bnxt/bnxt_stats.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/bnxt/bnxt_stats.c
> b/drivers/net/bnxt/bnxt_stats.c
> > index cfe193284..8df6922f5 100644
> > --- a/drivers/net/bnxt/bnxt_stats.c
> > +++ b/drivers/net/bnxt/bnxt_stats.c
> > @@ -1008,8 +1008,10 @@ int bnxt_flow_stats_req(struct bnxt *bp)
> >                 }
> >         }
> >
> > -       if (!in_flow_tbl_cnt)
> > +       if (!in_flow_tbl_cnt) {
> > +               bnxt_release_flow_lock(bp);
> >                 goto out;
> > +       }
> >
> >         rc = bnxt_update_fc_tbl(bp, counter_type, valid_en_tbl,
> >                                 in_flow_tbl_cnt);
> > --
> > 2.23.0
> >
> >
> Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
>
  

Patch

diff --git a/drivers/net/bnxt/bnxt_stats.c b/drivers/net/bnxt/bnxt_stats.c
index cfe193284..8df6922f5 100644
--- a/drivers/net/bnxt/bnxt_stats.c
+++ b/drivers/net/bnxt/bnxt_stats.c
@@ -1008,8 +1008,10 @@  int bnxt_flow_stats_req(struct bnxt *bp)
 		}
 	}
 
-	if (!in_flow_tbl_cnt)
+	if (!in_flow_tbl_cnt) {
+		bnxt_release_flow_lock(bp);
 		goto out;
+	}
 
 	rc = bnxt_update_fc_tbl(bp, counter_type, valid_en_tbl,
 				in_flow_tbl_cnt);