Skip to content

dispatcher: guard against missing volumes in assignments stream#3236

Open
grey3228 wants to merge 1 commit into
moby:masterfrom
grey3228:fix/avoid-nil-volume
Open

dispatcher: guard against missing volumes in assignments stream#3236
grey3228 wants to merge 1 commit into
moby:masterfrom
grey3228:fix/avoid-nil-volume

Conversation

@grey3228
Copy link
Copy Markdown

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 Assignments stream. When handling EventUpdateVolume, the dispatcher re-reads the volume from the store using store.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 over vol.PublishStatus, which can panic when vol is nil.

- How I did it

Check whether store.GetVolume returned 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.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant