Skip to content

Commit

Permalink
net/bnxt: fix null dereference in session cleanup
Browse files Browse the repository at this point in the history
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: a46bbb5 ("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>
  • Loading branch information
liwg06 authored and ajitkhaparde committed Mar 7, 2022
1 parent 272f94e commit a2dfcd1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/bnxt/tf_core/tf_session.c
Expand Up @@ -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;
}

Expand Down

0 comments on commit a2dfcd1

Please sign in to comment.