Blob Blame History Raw
From b7ee97acddee63c5991d901b0c9ea506fb33f611 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@redhat.com>
Date: Fri, 1 Feb 2013 16:47:30 +0100
Subject: [PATCH] patch: umax-init-error

Squashed commit of the following:

commit 13fb7a94adfa786b81a11755f22e8ab647cfac69
Author: Nils Philippsen <nils@redhat.com>
Date:   Wed Jan 16 11:57:37 2013 +0100

    umax: initialize reader_pid early in sane_start()

    This avoids that subsequent errors followed by do_cancel() attempt to
    phtread_cancel() an invalid thread (which may cause a crash).
    (cherry picked from commit defdc1ab5c365735ac85e347d463a01cf96fc72d)
---
 backend/umax.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/backend/umax.c b/backend/umax.c
index a9d1723..b2ceb00 100644
--- a/backend/umax.c
+++ b/backend/umax.c
@@ -7285,6 +7285,10 @@ SANE_Status sane_start(SANE_Handle handle)
 
   DBG(DBG_sane_init,"sane_start\n");
 
+  /* Initialize reader_pid to invalid so a subsequent error and following call
+   * to do_cancel() won't trip over it. */
+  scanner->reader_pid = -1;
+
   mode = scanner->val[OPT_MODE].s;
 
   if (scanner->device->sfd == -1)   /* first call, don`t run this routine again on multi frame or multi image scan */
-- 
1.8.1