Destroy mutex before file free, to avoid use after free of mutex.
Change-Id: I4ff73dc17b15043eacbb299219a379bfd1a8efa6
Acked-by: Himateja Reddy <hmreddy@qti.qualcomm.com>
Signed-off-by: Tharun Kumar Merugu <mtharu@codeaurora.org>
spin_unlock(&fl->apps->hlock);
if (!fl->sctx) {
- kfree(fl);
- return 0;
+ goto bail;
}
spin_lock(&fl->hlock);
fastrpc_session_free(&fl->apps->channel[cid], fl->sctx);
if (fl->secsctx)
fastrpc_session_free(&fl->apps->channel[cid], fl->secsctx);
+bail:
+ mutex_destroy(&fl->map_mutex);
kfree(fl);
return 0;
}
if (fl) {
if (fl->debugfs_file != NULL)
debugfs_remove(fl->debugfs_file);
- mutex_destroy(&fl->map_mutex);
+
fastrpc_file_free(fl);
file->private_data = NULL;
}