Skip to content

Commit

Permalink
santa-driver: fix use-after-free race in Get*MemoryDescriptor()
Browse files Browse the repository at this point in the history
  • Loading branch information
russellhancox committed Apr 7, 2020
1 parent 4e405be commit 31d7ecf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions Source/santa_driver/SantaDecisionManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,17 @@ void SantaDecisionManager::SetLogPort(mach_port_t port) {
}

IOMemoryDescriptor *SantaDecisionManager::GetDecisionMemoryDescriptor() const {
return decision_dataqueue_->getMemoryDescriptor();
lck_mtx_lock(decision_dataqueue_lock_);
IOMemoryDescriptor *r = decision_dataqueue_->getMemoryDescriptor();
lck_mtx_unlock(decision_dataqueue_lock_);
return r;
}

IOMemoryDescriptor *SantaDecisionManager::GetLogMemoryDescriptor() const {
return log_dataqueue_->getMemoryDescriptor();
lck_mtx_lock(log_dataqueue_lock_);
IOMemoryDescriptor *r = log_dataqueue_->getMemoryDescriptor();
lck_mtx_unlock(log_dataqueue_lock_);
return r;
}

#pragma mark Listener Control
Expand Down

0 comments on commit 31d7ecf

Please sign in to comment.