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
This commit is contained in:
Tatenda Chipeperekwa
2014-06-06 15:25:37 -07:00
parent 9ab5fd748f
commit a4550ce77e

View File

@@ -1309,6 +1309,7 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy,
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 @@ int hwc_sync(hwc_context_t *ctx, hwc_display_contents_1_t* list, int dpy,
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++) {