Details
Description
The mutex g_pvTkitLock is locked recursively. First in xDriverRestartDevice() and later in cifXTKitRemoveDevice() and cifXTKitAddDevice().
The mutex itself is created with the attribute PTHREAD_MUTEX_INITIALIZER which means it is non-recursive. The recursive version is PTHREAD_RMUTEX_INITIALIZER.
The function still works because the default configuration is PTHREAD_MUTEX_DEFAULT which is equivalent to PTHREAD_MUTEX_ERRORCHECK. This will only return an error when the mutex is locked recursively but the program execution will go on.
Possible solutions:
- Create mutexes with the attribute PTHREAD_MUTEX_NORMAL, which would cause a deadlock if the mutex is locked recursively.
- Create mutexes with the attribute PTHREAD_MUTEX_RECURSIVE.
- Change handling in xDriverRestartDevice().
xDriverRestartDevice() was introduced in (NXDRVQNX-8)