[sane-backends] umax: initialize reader_pid early in sane_start() (#853667)

Nils Philippsen nphilipp at fedoraproject.org
Fri Feb 1 16:00:03 UTC 2013


commit 8ec0611bd3b8acff4d343c72abea7d526355f50e
Author: Nils Philippsen <nils at redhat.com>
Date:   Fri Feb 1 16:52:28 2013 +0100

    umax: initialize reader_pid early in sane_start() (#853667)

 sane-backends-1.0.23-umax-init-error.patch |   38 ++++++++++++++++++++++++++++
 sane-backends.spec                         |    4 +++
 2 files changed, 42 insertions(+), 0 deletions(-)
---
diff --git a/sane-backends-1.0.23-umax-init-error.patch b/sane-backends-1.0.23-umax-init-error.patch
new file mode 100644
index 0000000..5cb1c61
--- /dev/null
+++ b/sane-backends-1.0.23-umax-init-error.patch
@@ -0,0 +1,38 @@
+From b7ee97acddee63c5991d901b0c9ea506fb33f611 Mon Sep 17 00:00:00 2001
+From: Nils Philippsen <nils at 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 at 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
+
diff --git a/sane-backends.spec b/sane-backends.spec
index 9243208..59e7e19 100644
--- a/sane-backends.spec
+++ b/sane-backends.spec
@@ -41,6 +41,8 @@ Patch2: sane-backends-1.0.21-SCX4500W.patch
 Patch3: sane-backends-1.0.23-soname.patch
 # Fedora-specific (for now): make installed sane-config multi-lib aware again
 Patch4: sane-backends-1.0.23-sane-config-multilib.patch
+# Submitted upstream: don't barf on umax init errors
+Patch5: sane-backends-1.0.23-umax-init-error.patch
 
 URL: http://www.sane-project.org
 
@@ -131,6 +133,7 @@ This package contains backend drivers to access digital cameras through SANE.
 %patch2 -p1 -b .SCX4500W
 %patch3 -p1 -b .soname
 %patch4 -p1 -b .sane-config-multilib
+%patch5 -p1 -b .umax-init-error
 
 %build
 %if ! 0%{?_hardened_build}
@@ -216,6 +219,7 @@ install -m 0644 tools/sane-backends.pc %{buildroot}%{_libdir}/pkgconfig/
 * Fri Feb 01 2013 Nils Philippsen <nils at redhat.com>
 - filter out backend driver provides/requires
 - update latex build dep
+- umax: initialize reader_pid early in sane_start() (#853667)
 
 * Mon Jan 21 2013 Adam Tkac <atkac redhat com> - 1.0.23-6
 - rebuild due to "jpeg8-ABI" feature drop


More information about the scm-commits mailing list