]> git.droids-corp.org - dpdk.git/commitdiff
net/bnxt: fix null dereference in session cleanup
authorWeiguo Li <liwg06@foxmail.com>
Thu, 24 Feb 2022 15:53:59 +0000 (23:53 +0800)
committerAjit Khaparde <ajit.khaparde@broadcom.com>
Mon, 7 Mar 2022 05:13:05 +0000 (06:13 +0100)
In tf_session_create(), there is a case that with 'tfp->session' still
be NULL and run 'goto cleanup', which will leads to a null dereference
by 'tfp_free(tfp->session->core_data)' in the cleanup.

Fixes: a46bbb57605b ("net/bnxt: update multi device design")
Cc: stable@dpdk.org
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/tf_core/tf_session.c

index 9f849a0a764884d526da536f5a095030a8974b2c..c30c0e7029d56c6b2247b672addfa3386b62747a 100644 (file)
@@ -230,10 +230,12 @@ tf_session_create(struct tf *tfp,
                            "FW Session close failed, rc:%s\n",
                            strerror(-rc));
        }
+       if (tfp->session) {
+               tfp_free(tfp->session->core_data);
+               tfp_free(tfp->session);
+               tfp->session = NULL;
+       }
 
-       tfp_free(tfp->session->core_data);
-       tfp_free(tfp->session);
-       tfp->session = NULL;
        return rc;
 }