dispatcher: guard against missing volumes in assignments stream#3236
Open
grey3228 wants to merge 1 commit into
Open
dispatcher: guard against missing volumes in assignments stream#3236grey3228 wants to merge 1 commit into
grey3228 wants to merge 1 commit into
Conversation
Assignments handles EventUpdateVolume by looking up the current volume from the store before updating the node assignment set. The lookup may return nil if the volume was removed after the event was queued but before it was processed. In that case, the code currently dereferences the nil volume while iterating over PublishStatus, which can panic and terminate the assignments stream handler. Skip processing when the volume is no longer present in the store. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Assignments handles EventUpdateVolume by looking up the current volume from the store before updating the node assignment set. The lookup may return nil if the volume was removed after the event was queued but before it was processed.
In that case, the code currently dereferences the nil volume while iterating over PublishStatus, which can panic and terminate the assignments stream handler.
- What I did
Fixed a possible nil pointer dereference in the dispatcher
Assignmentsstream. When handlingEventUpdateVolume, the dispatcher re-reads the volume from the store usingstore.GetVolume. That lookup can return nil if the volume has been removed by the time the queued event is processed. The code then immediately iterates overvol.PublishStatus, which can panic whenvolis nil.- How I did it
Check whether
store.GetVolumereturned nil before using the volume. Skip processing the stale volume update when the volume is no longer in the store.- Description for the changelog
Fixed a possible dispatcher panic when processing a volume update for a volume that no longer exists in the store.