fix: zesInit switch crash

The fix is provided to detect validity of sysman device handle in sysman APIs.
It can detect core device handle when passed instead of sysman device handle
in zesInit path and return error code.
Related-To: NEO-12690

Signed-off-by: Shreyas Kunder <shreyas.kunder@intel.com>
This commit is contained in:
Shreyas Kunder
2024-11-04 18:26:41 +00:00
committed by Compute-Runtime-Automation
parent 92b34f3b2c
commit f52f9753ed
11 changed files with 356 additions and 3 deletions

View File

@@ -153,6 +153,9 @@ ze_result_t LinuxEventsUtil::eventsListen(uint64_t timeout, uint32_t count, zes_
std::vector<zes_event_type_flags_t> registeredEvents(count);
for (uint32_t devIndex = 0; devIndex < count; devIndex++) {
auto device = static_cast<SysmanDeviceImp *>(L0::Sysman::SysmanDevice::fromHandle(phDevices[devIndex]));
if (device == nullptr) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
eventsMutex.lock();
if (deviceEventsMap.find(device) != deviceEventsMap.end()) {
registeredEvents[devIndex] = deviceEventsMap[device];