VirtualBox

Changeset 39354 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 17, 2011 5:03:18 PM (13 years ago)
Author:
vboxsync
Message:

Solaris/VBoxUSB: locking fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxUSB/solaris/VBoxUSB-solaris.c

    r38895 r39354  
    298298LOCAL void vboxUSBSolarisDestroyEndPoint(vboxusb_state_t *pState, vboxusb_ep_t *pEp);
    299299LOCAL void vboxUSBSolarisCloseAllPipes(vboxusb_state_t *pState, bool fControlPipe);
    300 LOCAL void vboxUSBSolarisCloseInterface(vboxusb_state_t *pState, uint8_t bInterface);
    301300LOCAL int vboxUSBSolarisOpenPipe(vboxusb_state_t *pState, vboxusb_ep_t *pEp);
    302301LOCAL void vboxUSBSolarisClosePipe(vboxusb_state_t *pState, vboxusb_ep_t *pEp);
     
    328327LOCAL int vboxUSBSolarisCloseDevice(vboxusb_state_t *pState, VBOXUSB_RESET_LEVEL enmReset);
    329328LOCAL int vboxUSBSolarisAbortPipe(vboxusb_state_t *pState, uint8_t bEndpoint);
    330 LOCAL bool vboxUSBSolarisIsAnyPipeOpen(vboxusb_state_t *pState);
    331329LOCAL int vboxUSBSolarisGetConfigIndex(vboxusb_state_t *pState, uint_t uCfgValue);
    332330
     
    703701             */
    704702            vboxUSBSolarisCloseAllPipes(pState, true /* ControlPipe */);
     703            pState->fClosed = true;
    705704
    706705            /*
     
    17231722            if (RT_FAILURE(rc))
    17241723            {
    1725                 freemsg(pUrb->pMsg);
     1724                mutex_enter(&pState->Mtx);
     1725                if (pUrb->pMsg)
     1726                {
     1727                    freemsg(pUrb->pMsg);
     1728                    pUrb->pMsg = NULL;
     1729                }
    17261730
    17271731                if (   pUrb->enmType == VUSBXFERTYPE_ISOC
     
    17361740                    pUrb->enmState = VBOXUSB_URB_STATE_FREE;
    17371741                }
     1742                mutex_exit(&pState->Mtx);
    17381743            }
    17391744        }
     
    25912596
    25922597/**
    2593  * Closes all pipes for a given interface.
    2594  *
    2595  * @param   pState          The USB device instance.
    2596  * @param   bInterface      The Interface.
    2597  */
    2598 LOCAL void vboxUSBSolarisCloseInterface(vboxusb_state_t *pState, uint8_t bInterface)
    2599 {
    2600     LogFunc((DEVICE_NAME ":vboxUSBSolarisCloseInterface pState=%p bInterface=%#x\n", pState, bInterface));
    2601 
    2602     for (int i = 1; i < VBOXUSB_MAX_ENDPOINTS; i++)
    2603     {
    2604         vboxusb_ep_t *pEp = &pState->aEps[i];
    2605         if (   pEp
    2606             && pEp->pPipe
    2607             && pEp->uInterface == bInterface)
    2608         {
    2609             Log((DEVICE_NAME ":vboxUSBSolarisCloseInterface closing[%d]\n", i));
    2610             vboxUSBSolarisClosePipe(pState, pEp);
    2611         }
    2612     }
    2613 }
    2614 
    2615 
    2616 /**
    26172598 * Open the pipe for an Endpoint.
    26182599 *
     
    27472728
    27482729    Assert(pEp->pPipe == NULL);
    2749 }
    2750 
    2751 
    2752 /**
    2753  * Check if any non-default Endpoints are open.
    2754  *
    2755  * @param   pState          The USB device instance.
    2756  *
    2757  * @returns Returns true if any non-default Endpoint is open, otherwise false.
    2758  */
    2759 LOCAL bool vboxUSBSolarisIsAnyPipeOpen(vboxusb_state_t *pState)
    2760 {
    2761     LogFunc((DEVICE_NAME ":vboxUSBSolarisIsAnyPipeOpen pState=%p\n", pState));
    2762 
    2763     for (int i = 1; i < VBOXUSB_MAX_ENDPOINTS; i++)
    2764     {
    2765         vboxusb_ep_t *pEp = &pState->aEps[i];
    2766         if (pEp->pPipe)
    2767         {
    2768             Log((DEVICE_NAME ":vboxUSBSolarisIsAnyPipeOpen pState=%p pEp=%p returns true.\n", pState, pEp));
    2769             return true;
    2770         }
    2771     }
    2772 
    2773     Log((DEVICE_NAME ":vboxUSBSolarisIsAnyPipeOpen pState=%p returns false.\n", pState));
    2774     return false;
    27752730}
    27762731
     
    28792834            && pUrb->enmState != VBOXUSB_URB_STATE_FREE))
    28802835    {
    2881         mutex_exit(&pState->Mtx);
    28822836        pUrb = RTMemAllocZ(sizeof(vboxusb_urb_t));
    28832837        if (RT_UNLIKELY(!pUrb))
    28842838        {
     2839            mutex_exit(&pState->Mtx);
    28852840            LogRel((DEVICE_NAME ":vboxUSBSolarisQueueURB failed to alloc %d bytes.\n", sizeof(vboxusb_urb_t)));
    28862841            return NULL;
    28872842        }
    2888         mutex_enter(&pState->Mtx);
    28892843    }
    28902844    else
     
    29012855
    29022856    pUrb->enmState = VBOXUSB_URB_STATE_INFLIGHT;
    2903 
    2904     mutex_exit(&pState->Mtx);
    29052857
    29062858    Assert(pUrb->pMsg == NULL);
     
    29262878        pUrb->pMsg = pMsg;
    29272879    }
     2880
     2881    mutex_exit(&pState->Mtx);
    29282882
    29292883    return pUrb;
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