Skip to content

Commit

Permalink
SCardCancel(): return SCARD_S_SUCCESS even if the client already fini…
Browse files Browse the repository at this point in the history
…shed

In some cases SCardCancel() is called exactly at the same time
SCardGetStatusChange() exits with SCARD_E_TIMEOUT.

In that case the SCardGetStatusChange() client disapears in the middle
of SCardCancel() processing. If the client is found but can't be
contacted then we return SCARD_S_SUCCESS instead of
SCARD_E_INVALID_HANDLE.

Thanks to Jakub Janků for the bug report
Closes: #160
"Concurrency issue with SCardCancel and SCardGetStatusChange timeout #160"
  • Loading branch information
LudovicRousseau committed Nov 3, 2023
1 parent f7ba829 commit f63ee99
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/winscard_svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,8 @@ static void * ContextThread(LPVOID newContext)
/* signal the client only if it was still waiting */
if (SCARD_S_SUCCESS == rv)
caStr.rv = MSGSignalClient(fd, SCARD_E_CANCELLED);
else
caStr.rv = SCARD_S_SUCCESS;
}

WRITE_BODY(caStr);
Expand Down

0 comments on commit f63ee99

Please sign in to comment.