libpdx_uds: Fix uninitialized variable bug.
In this code path epoll_wait() returns 0 when the operation times
out, but there is no condition to catch this and return the
approptiate status. This allows the event value to be used
uninitialized, which returns a junk pending event mask.
This bug results in BufferHub queues sometimes thinking that the
producer side of the buffer hung up, when the junk value happens
to have the EPOLLHUP bit set.
Bug: 62886596
Test: Observe VR app switching stability.
Change-Id: Id9554d6bf224fd27815ff042ac145f59041d0aae
diff --git a/libs/vr/libpdx_uds/channel_event_set.cpp b/libs/vr/libpdx_uds/channel_event_set.cpp
index ac4dea9..ebe7cea 100644
--- a/libs/vr/libpdx_uds/channel_event_set.cpp
+++ b/libs/vr/libpdx_uds/channel_event_set.cpp
@@ -100,6 +100,9 @@
ALOGE("ChannelEventReceiver::GetPendingEvents: Failed to get events: %s",
status.GetErrorMessage().c_str());
return status;
+ } else if (count == 0) {
+ status.SetError(ETIMEDOUT);
+ return status;
}
const int mask_out = event.data.u32;