Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osd/ReplicatedPG: avoid dereferencing iterator at end() #2362

Merged
merged 1 commit into from Sep 2, 2014
Merged

Conversation

liewegas
Copy link
Member

The preceding loop could terminate with p == snapset.clones.end(), which we
assign to dnewest. We can't dereference the iterator in that case.

For example:

start_flush ffe627f3/foo/a/test-rados-api-plana05-22080-18/83 v430'42 uv130
blocking
snapset b=[b,a]:[a,b]+head
start_flush no older clones

prev_snapc will be 0, oi.snaps will be [a], p will end up at end(), get
assigned to dnewest, and we'll dereference. It's only sometime harmful
though because we may still take the right (else) branch...

Fixes: #9294 Signed-off-by: Sage Weil sage@redhat.com

The preceding loop could terminate with p == snapset.clones.end(), which
we assign to dnewest.  We can't dereference the iterator in that case.

For example:

 start_flush ffe627f3/foo/a/test-rados-api-plana05-22080-18/83 v430'42 uv130 blocking
  snapset b=[b,a]:[a,b]+head
 start_flush no older clones

prev_snapc will be 0, oi.snaps will be [a], p will end up at end(), get
assigned to dnewest, and we'll dereference.  It's only sometime harmful
though because we may still take the right (else) branch...

Fixes: #9294
Signed-off-by: Sage Weil <sage@redhat.com>
athanatos pushed a commit that referenced this pull request Sep 2, 2014
osd/ReplicatedPG: avoid dereferencing iterator at end()

Reviewed-by: Samuel Just <sam.just@inktank.com>
@athanatos athanatos merged commit d0e0eb4 into master Sep 2, 2014
@athanatos athanatos deleted the wip-9294 branch September 2, 2014 19:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants