scd: Serialize opening device by select_application.
* scd/app.c (app_new_register): Don't lock APP_LIST_LOCK here. (select_application): Lock with APP_LIST_LOCK earlier.
What we want to do here is to serialize the call of
select_application. In the old code, it was possible
that a call of select_application was blocked internally,
and then another call of select_application entered.
We can have a dedicated lock for call of select_application,
but it is easier to re-use APP_LIST_LOCK.
- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>