From 394a6feb225f042035255bce733841987c70e334 Mon Sep 17 00:00:00 2001 From: NIIBE Yutaka Date: Wed, 6 Nov 2024 11:34:01 +0900 Subject: [PATCH] scd: Serialize CARD access for send_card_and_app_list. * scd/app.c (send_card_and_app_list): Lock the CARD. -- GnuPG-bug-id: 7323 Signed-off-by: NIIBE Yutaka --- scd/app.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scd/app.c b/scd/app.c index c6bfd3f51..bed058073 100644 --- a/scd/app.c +++ b/scd/app.c @@ -2762,9 +2762,14 @@ send_card_and_app_list (ctrl_t ctrl, card_t wantcard, int with_apps) for (n=0; n < ncardlist; n++) { - if (wantcard && wantcard != cardlist[n]) + card_t card = cardlist[n]; + + if (wantcard && wantcard != card) continue; - err = send_serialno_and_app_status (cardlist[n], with_apps, ctrl); + + lock_card (card, ctrl); + err = send_serialno_and_app_status (card, with_apps, ctrl); + unlock_card (card); if (err) goto leave; }