⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 277390 in webkit


Ignore:
Timestamp:
May 12, 2021, 2:19:06 PM (5 years ago)
Author:
jer.noble@apple.com
Message:

TapStorage::lock freed while locked in AudioSourceProviderAVFObjC::destroyMixIfNeeded()
https://bugs.webkit.org/show_bug.cgi?id=225706
<rdar://77719381>

Reviewed by Ryosuke Niwa.

In r275933, an update was made to protect access to TapStorage during destruction by
locking its lock inside destroyMixIfNeeded(), but if TapStorage has a refCount==1
during that teardown, the lock itself is destroyed while it is still held. Add an
explicit scoping to the lock holder, and only deref the TapStorage outside that
locking scope.

  • platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:

(WebCore::AudioSourceProviderAVFObjC::destroyMixIfNeeded):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r277385 r277390  
     12021-05-12  Jer Noble  <jer.noble@apple.com>
     2
     3        TapStorage::lock freed while locked in AudioSourceProviderAVFObjC::destroyMixIfNeeded()
     4        https://bugs.webkit.org/show_bug.cgi?id=225706
     5        <rdar://77719381>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        In r275933, an update was made to protect access to TapStorage during destruction by
     10        locking its lock inside destroyMixIfNeeded(), but if TapStorage has a refCount==1
     11        during that teardown, the lock itself is destroyed while it is still held. Add an
     12        explicit scoping to the lock holder, and only deref the TapStorage outside that
     13        locking scope.
     14
     15        * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm:
     16        (WebCore::AudioSourceProviderAVFObjC::destroyMixIfNeeded):
     17
    1182021-05-12  Said Abou-Hallawa  <said@apple.com>
    219
  • trunk/Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm

    r276301 r277390  
    183183        return;
    184184    ASSERT(m_tapStorage);
    185     auto locker = holdLock(m_tapStorage->lock);
    186     if (m_avPlayerItem)
    187         [m_avPlayerItem setAudioMix:nil];
    188     [m_avAudioMix setInputParameters:@[ ]];
    189     m_avAudioMix.clear();
    190     m_tap.clear();
    191     m_tapStorage->_this = nullptr;
     185    {
     186        auto locker = holdLock(m_tapStorage->lock);
     187        if (m_avPlayerItem)
     188            [m_avPlayerItem setAudioMix:nil];
     189        [m_avAudioMix setInputParameters:@[ ]];
     190        m_avAudioMix.clear();
     191        m_tap.clear();
     192        m_tapStorage->_this = nullptr;
     193        // Call unprepare, since Tap cannot call it after clear.
     194        unprepare();
     195        m_weakFactory.revokeAll();
     196    }
    192197    m_tapStorage = nullptr;
    193     // Call unprepare, since Tap cannot call it after clear.
    194     unprepare();
    195     m_weakFactory.revokeAll();
    196198}
    197199
Note: See TracChangeset for help on using the changeset viewer.