Skip to content

Commit

Permalink
net/bnxt: fix null dereference in session cleanup
Browse files Browse the repository at this point in the history
[ upstream commit a2dfcd1 ]

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")

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
  • Loading branch information
liwg06 authored and bluca committed Mar 9, 2022
1 parent c0f4bcb commit cfd9d09
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/net/bnxt/tf_core/tf_session.c
Expand Up @@ -182,9 +182,12 @@ tf_session_create(struct tf *tfp,
return 0;

cleanup:
tfp_free(tfp->session->core_data);
tfp_free(tfp->session);
tfp->session = NULL;
if (tfp->session) {
tfp_free(tfp->session->core_data);
tfp_free(tfp->session);
tfp->session = NULL;
}

return rc;
}

Expand Down

0 comments on commit cfd9d09

Please sign in to comment.