There are four different places where the program pointer may jump to 'cleanup:' while the mutex is still possilby being locked. Two of those cases are when mtx_lock(pthread_mutex_lock) fails to lock the mutex. However, this can't be a problem because the mutex is either not in "locked" state because current thread fails to acquire it or even if it's locked, it's owned by another thread.
The other two places are when mtx_unlock call fails to unlock the mutex. This is also not a problem. According to manpage, pthread_mutex_unlock only can return EINVAL or EPERM. EINVAL means the mutex is not initialized. But if it's uninialized, the code should have already failed while trying to acquiring it. EPERM is also not an issue because this error code means current thread doesn't own the mutex. In other words, the function is not responsible for unlocking it. On Wed, Apr 13, 2016 at 12:09:44PM -0700, Matt Turner wrote: > Looks like some locking problems caused by commit 70299474. Please take a > look. > > ---------- Forwarded message ---------- > From: <[email protected]> > Date: Wed, Apr 13, 2016 at 8:37 AM > Subject: New Defects reported by Coverity Scan for Mesa > > ________________________________________________________________________________________________________ > *** CID 1358496: (LOCK) > /src/egl/drivers/dri2/egl_dri2.c: 2643 in dri2_client_wait_sync() > 2637 > 2638 cleanup: > 2639 dri2_egl_unref_sync(dri2_dpy, dri2_sync); > 2640 > 2641 if (ret == EGL_FALSE) { > 2642 _eglError(EGL_BAD_ACCESS, "eglClientWaitSyncKHR"); > >>> CID 1358496: (LOCK) > >>> Returning without unlocking "dri2_sync->mutex". > 2643 return EGL_FALSE; > 2644 } > 2645 > 2646 return ret; > 2647 } > 2648 > /src/egl/drivers/dri2/egl_dri2.c: 2643 in dri2_client_wait_sync() > 2637 > 2638 cleanup: > 2639 dri2_egl_unref_sync(dri2_dpy, dri2_sync); > 2640 > 2641 if (ret == EGL_FALSE) { > 2642 _eglError(EGL_BAD_ACCESS, "eglClientWaitSyncKHR"); > >>> CID 1358496: (LOCK) > >>> Returning without unlocking "dri2_sync->mutex". > 2643 return EGL_FALSE; > 2644 } > 2645 > 2646 return ret; > 2647 } > 2648 _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
