X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/fe8ab488e9161c46dd9885d58fc52996dc0249ff..a39ff7e25e19b3a8c3020042a3872ca9ec9659f1:/iokit/Kernel/RootDomainUserClient.cpp diff --git a/iokit/Kernel/RootDomainUserClient.cpp b/iokit/Kernel/RootDomainUserClient.cpp index ae122f4c1..7a909d998 100644 --- a/iokit/Kernel/RootDomainUserClient.cpp +++ b/iokit/Kernel/RootDomainUserClient.cpp @@ -198,7 +198,7 @@ IOReturn RootDomainUserClient::secureSetUserAssertionLevels( } IOReturn RootDomainUserClient::secureGetSystemSleepType( - uint32_t *outSleepType) + uint32_t *outSleepType, uint32_t *sleepTimer) { int admin_priv = 0; IOReturn ret; @@ -207,7 +207,7 @@ IOReturn RootDomainUserClient::secureGetSystemSleepType( admin_priv = (kIOReturnSuccess == ret); if (admin_priv && fOwner) { - ret = fOwner->getSystemSleepType(outSleepType); + ret = fOwner->getSystemSleepType(outSleepType, sleepTimer); } else { ret = kIOReturnNotPrivileged; } @@ -216,14 +216,19 @@ IOReturn RootDomainUserClient::secureGetSystemSleepType( IOReturn RootDomainUserClient::clientClose( void ) { - detach(fOwner); + terminate(); + return kIOReturnSuccess; +} + +void RootDomainUserClient::stop( IOService *provider) +{ if(fOwningTask) { task_deallocate(fOwningTask); fOwningTask = 0; } - return kIOReturnSuccess; + super::stop(provider); } IOReturn RootDomainUserClient::externalMethod( @@ -299,10 +304,13 @@ IOReturn RootDomainUserClient::externalMethod( (uint32_t *)&arguments->scalarOutput[0]); break; case kPMSetMaintenanceWakeCalendar: - ret = this->secureSetMaintenanceWakeCalendar( - (IOPMCalendarStruct *)arguments->structureInput, - (uint32_t *)&arguments->structureOutput); - arguments->structureOutputSize = sizeof(uint32_t); + if ((arguments->structureInputSize >= sizeof(IOPMCalendarStruct)) && + (arguments->structureOutputSize >= sizeof(uint32_t) )) { + ret = this->secureSetMaintenanceWakeCalendar( + (IOPMCalendarStruct *)arguments->structureInput, + (uint32_t *)&arguments->structureOutput); + arguments->structureOutputSize = sizeof(uint32_t); + } break; case kPMSetUserAssertionLevels: @@ -325,10 +333,11 @@ IOReturn RootDomainUserClient::externalMethod( break; case kPMGetSystemSleepType: - if (1 == arguments->scalarOutputCount) + if (2 == arguments->scalarOutputCount) { ret = this->secureGetSystemSleepType( - (uint32_t *) &arguments->scalarOutput[0]); + (uint32_t *) &arguments->scalarOutput[0], + (uint32_t *) &arguments->scalarOutput[1]); } break;