Fix a rare use-after-free in automatic sync after delete in blockstore
ASan report: [0] READ of size 16 at operator() /root/vitastor/src/blockstore_write.cpp:100 ...[5] blockstore_impl_t::ack_sync(blockstore_op_t*) /root/vitastor/src/blockstore_sync.cpp:232
This commit is contained in:
@@ -95,11 +95,13 @@ bool blockstore_impl_t::enqueue_write(blockstore_op_t *op)
|
|||||||
// Issue an additional sync so the delete reaches the journal
|
// Issue an additional sync so the delete reaches the journal
|
||||||
blockstore_op_t *sync_op = new blockstore_op_t;
|
blockstore_op_t *sync_op = new blockstore_op_t;
|
||||||
sync_op->opcode = BS_OP_SYNC;
|
sync_op->opcode = BS_OP_SYNC;
|
||||||
sync_op->callback = [this, op](blockstore_op_t *sync_op)
|
sync_op->oid = op->oid;
|
||||||
|
sync_op->version = op->version;
|
||||||
|
sync_op->callback = [this](blockstore_op_t *sync_op)
|
||||||
{
|
{
|
||||||
flusher->unshift_flush((obj_ver_id){
|
flusher->unshift_flush((obj_ver_id){
|
||||||
.oid = op->oid,
|
.oid = sync_op->oid,
|
||||||
.version = op->version-1,
|
.version = sync_op->version-1,
|
||||||
}, true);
|
}, true);
|
||||||
delete sync_op;
|
delete sync_op;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user