Skip to content

Commit

Permalink
osdc: invalid read of freed memory
Browse files Browse the repository at this point in the history
The bytes not in cache stat was potentially reading the bh length
from a deleted bufferhead.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 5ccc442)
  • Loading branch information
Jason Dillaman committed Jul 17, 2015
1 parent 18ede75 commit aa3eb28
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/osdc/ObjectCacher.cc
Expand Up @@ -1144,6 +1144,7 @@ int ObjectCacher::_readx(OSDRead *rd, ObjectSet *oset, Context *onfinish,
++bh_it) {
uint64_t rx_bytes = static_cast<uint64_t>(
stat_rx + bh_it->second->length());
bytes_not_in_cache += bh_it->second->length();
if (!waitfor_read.empty() || rx_bytes > max_size) {
// cache is full with concurrent reads -- wait for rx's to complete
// to constrain memory growth (especially during copy-ups)
Expand All @@ -1165,7 +1166,6 @@ int ObjectCacher::_readx(OSDRead *rd, ObjectSet *oset, Context *onfinish,
bh_it->second->waitfor_read[bh_it->first].push_back( new C_RetryRead(this, rd, oset, onfinish) );
}
}
bytes_not_in_cache += bh_it->second->length();
success = false;
}

Expand Down

0 comments on commit aa3eb28

Please sign in to comment.