[xorg-x11-drv-synaptics/f17] Fix memory corruption on resume. Triggered if fingers are still on the

Peter Hutterer whot at fedoraproject.org
Thu Aug 30 22:10:43 UTC 2012


commit 923d5373b77ee320dacd328c5f88e7d6bf476645
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Aug 31 08:13:27 2012 +1000

    Fix memory corruption on resume. Triggered if fingers are still on the
    
      touchpad when the device is disabled.

 ...set-num_active_touches-on-DeviceOff-52496.patch |   54 ++++++++++++++++++++
 xorg-x11-drv-synaptics.spec                        |    9 +++-
 2 files changed, 62 insertions(+), 1 deletions(-)
---
diff --git a/0001-Reset-num_active_touches-on-DeviceOff-52496.patch b/0001-Reset-num_active_touches-on-DeviceOff-52496.patch
new file mode 100644
index 0000000..4577b2b
--- /dev/null
+++ b/0001-Reset-num_active_touches-on-DeviceOff-52496.patch
@@ -0,0 +1,54 @@
+From ff7195c64f9e278ae1185ce6fd13d93f899f2f60 Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Thu, 30 Aug 2012 16:38:38 +1000
+Subject: [PATCH synaptics] Reset num_active_touches on DeviceOff (#52496)
+
+When disabling the device, reset num_active_touches to zero. Otherwise,
+num_active_touches stays at the value it was on DeviceOff(). Future touches
+add to that value until the index may go past priv->open_slots[].
+That causes spurious memory corruption on touch ends.
+
+And as of 55fc42e7c9b4948cadd4f98ef7b6a3b12e268e3e we ignore pre-existing
+touches anyway.
+
+Test-case:
+- place num_touches fingers on the touchpad
+- xinput disable <device>
+- lift fingers
+- xinput enable <device>
+- place finger on device, num_active_touches is now (num_touches + 1)
+
+X.Org Bug 52496 <http://bugs.freedesktop.org/show_bug.cgi?id=52496>
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+(cherry picked from commit 7fae54967888ab06049c23eb1a35c2915160982b)
+
+Conflicts:
+	src/synaptics.c
+---
+ src/synaptics.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/synaptics.c b/src/synaptics.c
+index 2ba6aaf..dcb0f3e 100644
+--- a/src/synaptics.c
++++ b/src/synaptics.c
+@@ -1154,6 +1154,7 @@ SynapticsReset(SynapticsPrivate * priv)
+     priv->prev_z = 0;
+     priv->prevFingers = 0;
+ #ifdef HAVE_MULTITOUCH
++    priv->num_active_touches = 0;
+     memset(priv->open_slots, 0, priv->num_slots * sizeof(int));
+ #endif
+ }
+@@ -3118,6 +3119,7 @@ UpdateTouchState(InputInfoPtr pInfo, struct SynapticsHwState *hw)
+         if (hw->slot_state[i] == SLOTSTATE_OPEN) {
+             priv->open_slots[priv->num_active_touches] = i;
+             priv->num_active_touches++;
++            BUG_WARN(priv->num_active_touches > priv->num_slots);
+         }
+         else if (hw->slot_state[i] == SLOTSTATE_CLOSE) {
+             Bool found = FALSE;
+-- 
+1.7.11.2
+
diff --git a/xorg-x11-drv-synaptics.spec b/xorg-x11-drv-synaptics.spec
index ad3f835..dfe25a4 100644
--- a/xorg-x11-drv-synaptics.spec
+++ b/xorg-x11-drv-synaptics.spec
@@ -8,7 +8,7 @@
 Name:           xorg-x11-drv-synaptics
 Summary:        Xorg X11 Synaptics touchpad input driver
 Version:        1.6.2
-Release:        1%{?gitdate:.%{gitdate}git%{gitversion}}%{dist}
+Release:        2%{?gitdate:.%{gitdate}git%{gitversion}}%{dist}
 URL:            http://www.x.org
 License:        MIT
 Group:          User Interface/X Hardware Support
@@ -22,6 +22,8 @@ Source1:        50-synaptics.conf
 Source2:        make-git-snapshot.sh
 Source3:        70-touchpad-quirks.rules
 
+Patch02:        0001-Reset-num_active_touches-on-DeviceOff-52496.patch
+
 ExcludeArch:    s390 s390x %{?rhel:ppc ppc64}
 
 BuildRequires:  libtool pkgconfig
@@ -79,6 +81,7 @@ Features:
 
 %prep
 %setup -q -n %{tarball}-%{?gitdate:%{gitdate}}%{!?gitdate:%{version}}
+%patch02 -p1
 
 %build
 autoreconf -v --install --force || exit 1
@@ -135,6 +138,10 @@ Development files for the Synaptics TouchPad for X.Org.
 
 
 %changelog
+* Fri Aug 31 2012 Peter Hutterer <peter.hutterer at redhat.com> 1.6.2-2
+- Fix memory corruption on resume. Triggered if fingers are still on the
+  touchpad when the device is disabled.
+
 * Tue Jun 12 2012 Peter Hutterer <peter.hutterer at redhat.com> 1.6.2-1
 - synaptics 1.6.2
 


More information about the scm-commits mailing list