Skip to content

Commit

Permalink
Fix use-after-free bugs in icp code
Browse files Browse the repository at this point in the history
These were reported by Coverity as "Read from pointer after free" bugs.
Presumably, it did not report it as a use-after-free bug because it does
not understand the inline assembly that implements the atomic
instruction.

Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
  • Loading branch information
ryao committed Sep 13, 2022
1 parent 710fd1d commit 1785205
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion module/icp/core/kcf_mech_tabs.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ kcf_remove_mech_provider(const char *mech_name, kcf_provider_desc_t *prov_desc)
mech_entry->me_sw_prov = NULL;

/* free entry */
KCF_PROV_REFRELE(prov_mech->pm_prov_desc);
KCF_PROV_IREFRELE(prov_mech->pm_prov_desc);
KCF_PROV_REFRELE(prov_mech->pm_prov_desc);
kmem_free(prov_mech, sizeof (kcf_prov_mech_desc_t));
}

Expand Down
2 changes: 1 addition & 1 deletion module/icp/core/kcf_prov_tabs.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ kcf_prov_tab_rem_provider(crypto_provider_id_t prov_id)
* at that time.
*/

KCF_PROV_REFRELE(prov_desc);
KCF_PROV_IREFRELE(prov_desc);
KCF_PROV_REFRELE(prov_desc);

return (CRYPTO_SUCCESS);
}
Expand Down

0 comments on commit 1785205

Please sign in to comment.