hwc: Close release fence fd on buf sync ioctl failure
This change closes the release fence fd in the event that
a failure occurs during the buf sync ioctl. This is additional
sanity to ensure that we are not leaking any fd's in userspace.
Change-Id: Ic303aa2a2ed20244605b0f0bd91145e8f3fc8f1b
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 59e39bb..6a0d210 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -1309,6 +1309,7 @@
if(ret < 0) {
ALOGE("%s: ioctl MSMFB_BUFFER_SYNC failed for rot sync, err=%s",
__FUNCTION__, strerror(errno));
+ close(rotReleaseFd);
} else {
close(currLayer->acquireFenceFd);
//For MDP to wait on.
@@ -1380,6 +1381,10 @@
ALOGE("%s: acq_fen_fd_cnt=%d flags=%d fd=%d dpy=%d numHwLayers=%zu",
__FUNCTION__, data.acq_fen_fd_cnt, data.flags, fbFd,
dpy, list->numHwLayers);
+ close(releaseFd);
+ releaseFd = -1;
+ close(retireFd);
+ retireFd = -1;
}
for(uint32_t i = 0; i < list->numHwLayers; i++) {