[git] GnuPG - branch, master, updated. gnupg-2.2.7-288-g47106ac

by NIIBE Yutaka cvs at cvs.gnupg.org
Wed Nov 28 07:05:22 CET 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".

The branch, master has been updated
       via  47106ac435e891ced67f0ad9bb6b2ee12098c880 (commit)
      from  483e63f9b5faead819ddd28308902ef43bf298ab (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 47106ac435e891ced67f0ad9bb6b2ee12098c880
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Wed Nov 28 14:59:44 2018 +0900

    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 at fsij.org>

diff --git a/scd/app.c b/scd/app.c
index a82db26..d16300e 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -299,11 +299,8 @@ app_new_register (int slot, ctrl_t ctrl, const char *name,
     }
 
   app->periodical_check_needed = periodical_check_needed;
-
-  npth_mutex_lock (&app_list_lock);
   app->next = app_top;
   app_top = app;
-  npth_mutex_unlock (&app_list_lock);
   unlock_app (app);
   return 0;
 }
@@ -322,6 +319,8 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app,
 
   *r_app = NULL;
 
+  npth_mutex_lock (&app_list_lock);
+
   if (scan || !app_top)
     {
       struct dev_list *l;
@@ -330,7 +329,10 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app,
       /* Scan the devices to find new device(s).  */
       err = apdu_dev_list_start (opt.reader_port, &l);
       if (err)
-        return err;
+        {
+          npth_mutex_unlock (&app_list_lock);
+          return err;
+        }
 
       while (1)
         {
@@ -365,7 +367,6 @@ select_application (ctrl_t ctrl, const char *name, app_t *r_app,
         scd_kick_the_loop ();
     }
 
-  npth_mutex_lock (&app_list_lock);
   for (a = app_top; a; a = a->next)
     {
       lock_app (a, ctrl);

-----------------------------------------------------------------------

Summary of changes:
 scd/app.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
The GNU Privacy Guard
http://git.gnupg.org




More information about the Gnupg-commits mailing list