VirtualBox

Changeset 99311 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 6, 2023 7:20:06 AM (22 months ago)
Author:
vboxsync
Message:

Audio/AC97: Acquire the mixer sink locks in ichac97R3StreamReSetUp(). bugref:10350

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/DevIchAc97.cpp

    r98625 r99311  
    20302030    }
    20312031
     2032    /** Validate locks -- see @bugref{10350}. */
     2033    Assert(PDMDevHlpCritSectIsOwner(pDevIns, &pThis->CritSect));
     2034    Assert(RTCritSectIsOwned(&pStreamCC->State.CritSect));
     2035    Assert(AudioMixerSinkLockIsOwned(pMixSink));
     2036
    20322037    /*
    20332038     * Don't continue if the frequency is out of range (the rest of the
     
    22732278 * @param   fForce      Whether to force re-opening the stream or not.
    22742279 *                      Otherwise re-opening only will happen if the PCM properties have changed.
     2280 *
     2281 * @remarks This is called holding:
     2282 *              -# The AC'97 device lock.
     2283 *
     2284 *          Will acquire the stream and mixer sink locks. See @bugref{10350}
    22752285 */
    22762286static int ichac97R3StreamReSetUp(PPDMDEVINS pDevIns, PAC97STATE pThis, PAC97STATER3 pThisCC,
     
    22822292    Assert(pStream   - &pThis->aStreams[0]   == pStream->u8SD);
    22832293    Assert(pStreamCC - &pThisCC->aStreams[0] == pStream->u8SD);
     2294
     2295    ichac97R3StreamLock(pStreamCC);
     2296    PAUDMIXSINK const pSink = ichac97R3IndexToSink(pThisCC, pStream->u8SD);
     2297    if (pSink)
     2298        AudioMixerSinkLock(pSink);
    22842299
    22852300    ichac97R3StreamTearDown(pStream);
     
    22892304    else
    22902305        STAM_REL_PROFILE_STOP_NS(&pStreamCC->State.StatReSetUpChanged, r);
     2306
     2307    if (pSink)
     2308        AudioMixerSinkUnlock(pSink);
     2309    ichac97R3StreamUnlock(pStreamCC);
     2310
    22912311    return rc;
    22922312}
     
    23102330    ichac97R3StreamLock(pStreamCC);
    23112331    PAUDMIXSINK const pSink = ichac97R3IndexToSink(pThisCC, pStream->u8SD);
    2312     AudioMixerSinkLock(pSink);
     2332    if (pSink)
     2333        AudioMixerSinkLock(pSink);
    23132334
    23142335    int rc = VINF_SUCCESS;
     
    23402361
    23412362            /* Do the actual enabling (won't fail as long as pSink is valid). */
    2342             rc = AudioMixerSinkStart(pSink);
     2363            if (pSink)
     2364                rc = AudioMixerSinkStart(pSink);
    23432365        }
    23442366    }
     
    23532375
    23542376    /* Make sure to leave the lock before (eventually) starting the timer. */
    2355     AudioMixerSinkUnlock(pSink);
     2377    if (pSink)
     2378        AudioMixerSinkUnlock(pSink);
    23562379    ichac97R3StreamUnlock(pStreamCC);
    23572380    LogFunc(("[SD%RU8] fEnable=%RTbool, rc=%Rrc\n", pStream->u8SD, fEnable, rc));
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette