Changeset 10556 in vbox
- Timestamp:
- Jul 11, 2008 10:02:09 PM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 33248
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDrv.c
r10387 r10556 1482 1482 * @param pvObj The identifier returned by SUPR0ObjRegister(). 1483 1483 * @param pSession The session which is referencing the object. 1484 * 1485 * @remarks The caller should not own any spinlocks and must carefully protect 1486 * itself against potential race with the destructor so freed memory 1487 * isn't accessed here. 1484 1488 */ 1485 1489 SUPR0DECL(int) SUPR0ObjAddRef(void *pvObj, PSUPDRVSESSION pSession) … … 1493 1497 /* 1494 1498 * Validate the input. 1499 * Be ready for the destruction race (someone might be stuck in the 1500 * destructor waiting a lock we own). 1495 1501 */ 1496 1502 AssertReturn(SUP_IS_SESSION_VALID(pSession), VERR_INVALID_PARAMETER); 1497 AssertMsgReturn(VALID_PTR(pObj) && pObj->u32Magic == SUPDRVOBJ_MAGIC, 1498 ("Invalid pvObj=%p magic=%#x (exepcted %#x)\n", pvObj, pObj ? pObj->u32Magic : 0, SUPDRVOBJ_MAGIC), 1503 AssertPtrReturn(pObj, VERR_INVALID_POINTER); 1504 AssertMsgReturn(pObj->u32Magic == SUPDRVOBJ_MAGIC || pObj->u32Magic == SUPDRVOBJ_MAGIC + 1, 1505 ("Invalid pvObj=%p magic=%#x (expected %#x or %#x)\n", pvObj, pObj->u32Magic, SUPDRVOBJ_MAGIC, SUPDRVOBJ_MAGIC + 1), 1499 1506 VERR_INVALID_PARAMETER); 1500 1507 1508 RTSpinlockAcquire(pDevExt->Spinlock, &SpinlockTmp); 1509 1510 if (RT_UNLIKELY(pObj->u32Magic != SUPDRVOBJ_MAGIC)) 1511 { 1512 AssertMsg(pObj->u32Magic == SUPDRVOBJ_MAGIC + 1, ("pvObj=%p magic=%#x\n", pvObj, pObj->u32Magic)); 1513 1514 RTSpinlockRelease(pDevExt->Spinlock, &SpinlockTmp); 1515 return VERR_WRONG_ORDER; 1516 } 1517 1501 1518 /* 1502 1519 * Preallocate the usage record. 1503 1520 */ 1504 RTSpinlockAcquire(pDevExt->Spinlock, &SpinlockTmp);1505 1506 1521 pUsagePre = pDevExt->pUsageFree; 1507 1522 if (pUsagePre) … … 1513 1528 if (!pUsagePre) 1514 1529 return VERR_NO_MEMORY; 1530 1515 1531 RTSpinlockAcquire(pDevExt->Spinlock, &SpinlockTmp); 1516 1532 }
Note:
See TracChangeset
for help on using the changeset viewer.