summaryrefslogtreecommitdiffstats
path: root/main/libfprint/0003-imgdev-fix-cancelling-of-enrollment-from-stage_compl.patch
blob: 303090c7ead35b3adee79b44aac37a88f5a8fb75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
From 72bf2bc90e5e5fccc10f77859dbba666d055df9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Mon, 3 Dec 2012 09:57:25 +0200
Subject: [PATCH 3/3] imgdev: fix cancelling of enrollment from stage_completed
 callback

Re-check device state after fpi_drvcb_enroll_stage_completed().
If enrollment was cancelled after non-completing stage, we must
not restart acquire as it would confuse the internal state machine.

https://bugs.freedesktop.org/show_bug.cgi?id=57829
---
 libfprint/imgdev.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libfprint/imgdev.c b/libfprint/imgdev.c
index 14e41ae..1ed3f6d 100644
--- a/libfprint/imgdev.c
+++ b/libfprint/imgdev.c
@@ -145,7 +145,10 @@ void fpi_imgdev_report_finger_status(struct fp_img_dev *imgdev,
 	case IMG_ACTION_ENROLL:
 		fp_dbg("reporting enroll result");
 		fpi_drvcb_enroll_stage_completed(imgdev->dev, r, data, img);
-		if (r > 0 && r != FP_ENROLL_COMPLETE && r != FP_ENROLL_FAIL) {
+		/* the callback can cancel enrollment, so recheck current
+		 * action and the status to see if retry is needed */
+		if (imgdev->action == IMG_ACTION_ENROLL &&
+		    r > 0 && r != FP_ENROLL_COMPLETE && r != FP_ENROLL_FAIL) {
 			imgdev->action_result = 0;
 			imgdev->action_state = IMG_ACQUIRE_STATE_AWAIT_FINGER_ON;
 			dev_change_state(imgdev, IMG_ACQUIRE_STATE_AWAIT_FINGER_ON);
-- 
1.8.0.1