mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-10 21:38:50 +01:00
agent: Fix a race condition which results accessing finished scd.
* agent/call-daemon.c (daemon_start): Decision of connection/reuse of
CTX and assignment to ->ctx should be done with the lock.
--
When scdaemon is exiting and agent tries to spawn/connect/reconnect,
there is a race condition between detecting finish of scd and
spawn/connect/reconnect.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
(cherry picked from commit 563bfbb0be
)
This commit is contained in:
parent
a564a9f66c
commit
c868d23f61
@ -511,13 +511,12 @@ daemon_start (enum daemon_type type, ctrl_t ctrl)
|
||||
}
|
||||
|
||||
leave:
|
||||
rc = npth_mutex_unlock (&start_daemon_lock);
|
||||
if (rc)
|
||||
log_error ("failed to release the start_daemon lock: %s\n", strerror (rc));
|
||||
|
||||
xfree (abs_homedir);
|
||||
if (err)
|
||||
{
|
||||
rc = npth_mutex_unlock (&start_daemon_lock);
|
||||
if (rc)
|
||||
log_error ("failed to release the start_daemon lock: %s\n", strerror (rc));
|
||||
daemon_unlock (type, ctrl, err);
|
||||
if (ctx)
|
||||
assuan_release (ctx);
|
||||
@ -526,6 +525,9 @@ daemon_start (enum daemon_type type, ctrl_t ctrl)
|
||||
{
|
||||
ctrl->d_local[type]->ctx = ctx;
|
||||
ctrl->d_local[type]->invalid = 0;
|
||||
rc = npth_mutex_unlock (&start_daemon_lock);
|
||||
if (rc)
|
||||
log_error ("failed to release the start_daemon lock: %s\n", strerror (rc));
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user