net/bnxt: fix null dereference in session cleanup

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>
This commit is contained in:
Weiguo Li 2022-02-24 23:53:59 +08:00 committed by Ajit Khaparde
parent 272f94e58b
commit a2dfcd1ff6

View 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;
}