crypto: remove release process in close

The callback parameters are currently passed in by the upper layer, so the release process in close should not be performed here.

This prevents double-free issues and ensures proper resource management.

Signed-off-by: makejian <makejian@xiaomi.com>
This commit is contained in:
makejian
2025-09-22 10:01:56 +08:00
committed by Xiang Xiao
parent 3b151ae44b
commit eea0f45e04

View File

@@ -872,8 +872,6 @@ static int cryptof_close(FAR struct file *filep)
{
FAR struct fcrypt *fcr = filep->f_priv;
FAR struct csession *cse;
FAR struct cryptkop *krp;
int i;
while ((cse = TAILQ_FIRST(&fcr->csessions)))
{
@@ -881,22 +879,6 @@ static int cryptof_close(FAR struct file *filep)
(void)csefree(cse);
}
while ((krp = TAILQ_FIRST(&fcr->crpk_ret)))
{
TAILQ_REMOVE(&fcr->crpk_ret, krp, krp_next);
for (i = 0; i < CRK_MAXPARAM; i++)
{
if (krp->krp_param[i].crp_p)
{
explicit_bzero(krp->krp_param[i].crp_p,
(krp->krp_param[i].crp_nbits + 7) / 8);
kmm_free(krp->krp_param[i].crp_p);
}
}
kmm_free(krp);
}
kmm_free(fcr);
filep->f_priv = NULL;
return 0;