Skip to content

Commit

Permalink
Merge pull request #579 from mihalicyn/cpuview_deadlock
Browse files Browse the repository at this point in the history
cpuview: fix ABBA deadlock in find_proc_stat_node
  • Loading branch information
Christian Brauner authored Jan 16, 2023
2 parents 0f7fe14 + 1e8d209 commit cd2e3ac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/proc_cpuview.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ static struct cg_proc_stat *find_proc_stat_node(struct cg_proc_stat_head *head,
{
struct cg_proc_stat *node;

prune_proc_stat_history();
pthread_rwlock_rdlock(&head->lock);

if (!head->next) {
Expand All @@ -327,7 +328,6 @@ static struct cg_proc_stat *find_proc_stat_node(struct cg_proc_stat_head *head,

out:
pthread_rwlock_unlock(&head->lock);
prune_proc_stat_history();
return node;
}

Expand Down

0 comments on commit cd2e3ac

Please sign in to comment.