[Pcsclite-muscle] [PATCH] Fix invalid pthread_mutex_unlock in CreateContextThread

Giuseppe M gdm23
Thu Oct 2 04:40:30 PDT 2014


On 02/10/14 13:25, Ludovic Rousseau wrote:
> I don't think this patch is correct.
>
> The original code is:
>
>     (void)pthread_mutex_lock(&contextsList_lock);
>
>     listSize = list_size(&contextsList);
>     if (listSize >= contextMaxThreadCounter)
>     {
>         Log2(PCSC_LOG_CRITICAL, "Too many context running: %d", listSize);
>         goto out;
>     }
>
> [...]
> out:
>     (void)pthread_mutex_unlock(&contextsList_lock);
>
>
> You HAVE to unlock in the if since the mutex lock is done before.
>
>
> What is exactly the problem reported by valgrind?
I see now, sorry for the noise. I thought this patch was fixing
something because other invalid reads/writes (in pthread_mutex_destroy()
calls, same as reported in the referenced archived messages) would
disappear with it. But cause is probably in the proprietary driver as well.

Thanks

--
  Giuseppe M
  https://keybase.io/gdm85






More information about the pcsclite-muscle mailing list