Skip to content

Commit 111d75b

Browse files
committed
librlist: fix use-after-free after rlist_remove_ranks()
Problem: rlist_remove_rank() removes the requested rnode from the rlist nodes list, but doesn't delete the item from the rank hash. This can lead to a use-after-free if the removed rank is looked up after this. Call rank_hash_delete() after the rank is deleted from the nodes list to ensure references to the removed rnode.
1 parent e479077 commit 111d75b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/common/librlist/rlist.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ static int rlist_remove_rank (struct rlist *rl, int rank)
398398
errno = ENOENT;
399399
return -1;
400400
}
401+
rank_hash_delete (rl, rank);
401402
zlistx_delete (rl->nodes, handle);
402403
return 0;
403404
}

0 commit comments

Comments
 (0)