Changeset 214786 in webkit


Ignore:
Timestamp:
Apr 3, 2017 6:08:46 AM (7 years ago)
Author:
Antti Koivisto
Message:

Mutex may be freed too late in NetworkCache::Storage::traverse
https://bugs.webkit.org/show_bug.cgi?id=170400
<rdar://problem/30515865>

Reviewed by Carlos Garcia Campos and Andreas Kling.

Fix a race.

  • NetworkProcess/cache/NetworkCacheStorage.cpp:

(WebKit::NetworkCache::Storage::traverse):

Ensure the mutex is not accessed after we dispatch to the main thread.
The main thread call deletes the owning TraverseOperation.

Location:
trunk/Source/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r214723 r214786  
     12017-04-03  Antti Koivisto  <antti@apple.com>
     2
     3        Mutex may be freed too late in NetworkCache::Storage::traverse
     4        https://bugs.webkit.org/show_bug.cgi?id=170400
     5        <rdar://problem/30515865>
     6
     7        Reviewed by Carlos Garcia Campos and Andreas Kling.
     8
     9        Fix a race.
     10
     11        * NetworkProcess/cache/NetworkCacheStorage.cpp:
     12        (WebKit::NetworkCache::Storage::traverse):
     13
     14            Ensure the mutex is not accessed after we dispatch to the main thread.
     15            The main thread call deletes the owning TraverseOperation.
     16
    1172017-04-01  Dan Bernstein  <mitz@apple.com>
    218
  • trunk/Source/WebKit2/NetworkProcess/cache/NetworkCacheStorage.cpp

    r214101 r214786  
    860860            });
    861861        });
    862         // Wait for all reads to finish.
    863         std::unique_lock<Lock> lock(traverseOperation.activeMutex);
    864         traverseOperation.activeCondition.wait(lock, [&traverseOperation] {
    865             return !traverseOperation.activeCount;
    866         });
     862        {
     863            // Wait for all reads to finish.
     864            std::unique_lock<Lock> lock(traverseOperation.activeMutex);
     865            traverseOperation.activeCondition.wait(lock, [&traverseOperation] {
     866                return !traverseOperation.activeCount;
     867            });
     868        }
    867869        RunLoop::main().dispatch([this, &traverseOperation] {
    868870            traverseOperation.handler(nullptr, { });
Note: See TracChangeset for help on using the changeset viewer.