mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-01 16:33:02 +01:00
scd: Fix race conditions for release_application.
* scd/command.c (do_reset, cmd_restart): Reset app_ctx before calling release_application. -- Thanks to Ben Warren for the report. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
f474249366
commit
0c1fd4e988
@ -261,6 +261,7 @@ do_reset (ctrl_t ctrl, int send_reset)
|
|||||||
int vrdr = ctrl->server_local->vreader_idx;
|
int vrdr = ctrl->server_local->vreader_idx;
|
||||||
int slot;
|
int slot;
|
||||||
int err;
|
int err;
|
||||||
|
struct app_ctx_s *app = ctrl->app_ctx;
|
||||||
|
|
||||||
if (!(vrdr == -1 || (vrdr >= 0 && vrdr < DIM(vreader_table))))
|
if (!(vrdr == -1 || (vrdr >= 0 && vrdr < DIM(vreader_table))))
|
||||||
BUG ();
|
BUG ();
|
||||||
@ -268,10 +269,10 @@ do_reset (ctrl_t ctrl, int send_reset)
|
|||||||
/* If there is an active application, release it. Tell all other
|
/* If there is an active application, release it. Tell all other
|
||||||
sessions using the same application to release the
|
sessions using the same application to release the
|
||||||
application. */
|
application. */
|
||||||
if (ctrl->app_ctx)
|
if (app)
|
||||||
{
|
{
|
||||||
release_application (ctrl->app_ctx);
|
|
||||||
ctrl->app_ctx = NULL;
|
ctrl->app_ctx = NULL;
|
||||||
|
release_application (app);
|
||||||
if (send_reset)
|
if (send_reset)
|
||||||
{
|
{
|
||||||
struct server_local_s *sl;
|
struct server_local_s *sl;
|
||||||
@ -1742,13 +1743,14 @@ static gpg_error_t
|
|||||||
cmd_restart (assuan_context_t ctx, char *line)
|
cmd_restart (assuan_context_t ctx, char *line)
|
||||||
{
|
{
|
||||||
ctrl_t ctrl = assuan_get_pointer (ctx);
|
ctrl_t ctrl = assuan_get_pointer (ctx);
|
||||||
|
struct app_ctx_s *app = ctrl->app_ctx;
|
||||||
|
|
||||||
(void)line;
|
(void)line;
|
||||||
|
|
||||||
if (ctrl->app_ctx)
|
if (app)
|
||||||
{
|
{
|
||||||
release_application (ctrl->app_ctx);
|
|
||||||
ctrl->app_ctx = NULL;
|
ctrl->app_ctx = NULL;
|
||||||
|
release_application (app);
|
||||||
}
|
}
|
||||||
if (locked_session && ctrl->server_local == locked_session)
|
if (locked_session && ctrl->server_local == locked_session)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user