Skip to content

Commit

Permalink
core/cpu: Fix theoretical use-after-free if no_return job returns
Browse files Browse the repository at this point in the history
Practically speaking this should/would never happen, but static analysis
caught it, and just *maybe* at some time in the future, someone will
have less of a terrible day debugging something terrible if we fix it.

Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
  • Loading branch information
stewartsmith committed Jun 4, 2019
1 parent a66f5a8 commit 2d4c7f9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/cpu.c
Expand Up @@ -361,8 +361,12 @@ void cpu_process_jobs(void)
free(job);
func(data);
if (!list_empty(&cpu->locks_held)) {
prlog(PR_ERR, "OPAL job %s returning with locks held\n",
job->name);
if (no_return)
prlog(PR_ERR, "OPAL no-return job returned with"
"locks held!\n");
else
prlog(PR_ERR, "OPAL job %s returning with locks held\n",
job->name);
drop_my_locks(true);
}
lock(&cpu->job_lock);
Expand Down

0 comments on commit 2d4c7f9

Please sign in to comment.