Commit c60115f8 authored by Stuart Langley's avatar Stuart Langley Committed by Commit Bot

Do not call GetResourceEntryCallback multiple times.

GetResourceEntryCallback is really on a once callback, and by processing
multiple team drive entries in the loop we introduce a race condition that
can cause a SIGSEGV in private_api_drive when the callback is fired multiple
times.

Followup work is to get the Deduplicated name for the team drive and store that
as the path so that the lookup will only match once.

Bug: 875140
Change-Id: I35e381aa82d7c34e200ddc44b085205115fadd86
Reviewed-on: https://chromium-review.googlesource.com/1179483Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Commit-Queue: Stuart Langley <slangley@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583974}
parent 30a80e48
......@@ -664,10 +664,7 @@ void FileSystem::ReadDirectory(
if (util::GetDriveTeamDrivesRootPath().IsParent(directory_path)) {
// If we do not match a single team drive then we will run the default
// corpus loader to read the directory. More than one team drive may match
// the path so we loop through all of them (team drive roots may have the
// same name).
bool matched_team_drive = false;
// corpus loader to read the directory.
for (auto& team_drive_loader : team_drive_change_list_loaders_) {
const base::FilePath& team_drive_path =
team_drive_loader.second->root_entry_path();
......@@ -675,14 +672,9 @@ void FileSystem::ReadDirectory(
team_drive_path.IsParent(directory_path)) {
team_drive_loader.second->ReadDirectory(
directory_path, entries_callback, completion_callback);
matched_team_drive = true;
return;
}
}
if (matched_team_drive) {
return;
} else {
DVLOG(1) << "No team drive loader for path, " << directory_path;
}
}
// Fall through to the default corpus loader if no team drive loader is found.
// We do not refresh the list of team drives from the server until the first
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment