Fix: fenced: Prevent segfault by not merging with in-flight fencing actions#4152
Fix: fenced: Prevent segfault by not merging with in-flight fencing actions#4152gao-yan wants to merge 1 commit into
Conversation
…ctions With "pcmk_action_limit" configured to be -1 or > 1 for the fencing resource, it's possible that when reply_to_duplicates() is called, some matching commands in cmd_list are already in-flight. Previously such in-flight commands would be merged and freed. Then when a command eventually returned and st_child_done() was called, it would segfault due to use-after-free of cmd. This commit fixes the issue by not merging with any in-flight fencing actions.
|
Haven't been dealing with this code for a while but wouldn't it be the better approach to simply free the one that isn't yet in-flight? |
If any matching one isn't yet in-flight, it will be freed with the logic in below then. But in here, we are talking about those that are already in-flight. When the first one returns, it shouldn't merge with the other already in-flight ones anyways. We just shouldn't free/forget something that is already in-flight and has a callback registered to be called upon returning.
As a matter of fact, some duplicate fencing actions can be merged at the initialization stage with |
With "pcmk_action_limit" configured to be -1 or > 1 for the fencing resource, it's possible that when reply_to_duplicates() is called, some matching commands in cmd_list are already in-flight. Previously such in-flight commands would be merged and freed. Then when a command eventually returned and st_child_done() was called, it would segfault due to use-after-free of cmd.
This commit fixes the issue by not merging with any in-flight fencing actions.