xserver: Branch 'server-1.15-branch' - 3 commits

Matt Dew marcoz at kemper.freedesktop.org
Fri Mar 14 21:00:57 PDT 2014


 Xext/sync.c        |    7 ++-----
 Xi/exevents.c      |    3 ++-
 Xi/xipassivegrab.c |    4 ++++
 config/hal.c       |   16 +++++++++++++---
 config/udev.c      |   15 +++++++++++----
 5 files changed, 32 insertions(+), 13 deletions(-)

New commits:
commit c971864565eb114e4b34f17b0d2244e8e6e1e005
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Wed Feb 26 07:54:56 2014 +1000

    config: search for PnPID on all parents (#75513)
    
    The PnPID for a device may not be on the immediate parent, so search up the
    device tree until we find one.
    
    X.Org Bug 75513 <http://bugs.freedesktop.org/show_bug.cgi?id=75513>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Tested-by: Benjamin Tissoires <benjamin.tissoires at gmail.com>
    (cherry picked from commit 795066477ee81b5b82e490eac8bed6b656d01f17)

diff --git a/config/hal.c b/config/hal.c
index 2ead556..d8e8db7 100644
--- a/config/hal.c
+++ b/config/hal.c
@@ -184,8 +184,7 @@ device_added(LibHalContext * hal_ctx, const char *udi)
     parent = get_prop_string(hal_ctx, udi, "info.parent");
     if (parent) {
         int usb_vendor, usb_product;
-
-        attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id");
+        char *old_parent;
 
         /* construct USB ID in lowercase - "0000:ffff" */
         usb_vendor = libhal_device_get_property_int(hal_ctx, parent,
@@ -203,7 +202,18 @@ device_added(LibHalContext * hal_ctx, const char *udi)
                 == -1)
                 attrs.usb_id = NULL;
 
-        free(parent);
+        attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id");
+        old_parent = parent;
+
+        while (!attrs.pnp_id &&
+               (parent = get_prop_string(hal_ctx, parent, "info.parent"))) {
+            attrs.pnp_id = get_prop_string(hal_ctx, parent, "pnp.id");
+
+            free(old_parent);
+            old_parent = parent;
+        }
+
+        free(old_parent);
     }
 
     input_options = input_option_new(NULL, "_source", "server/hal");
diff --git a/config/udev.c b/config/udev.c
index b55b78e..bcafbd9 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -130,10 +130,6 @@ device_added(struct udev_device *udev_device)
             LOG_PROPERTY(ppath, "NAME", name);
         }
 
-        if (pnp_id)
-            attrs.pnp_id = strdup(pnp_id);
-        LOG_SYSATTR(ppath, "id", pnp_id);
-
         /* construct USB ID in lowercase hex - "0000:ffff" */
         if (product &&
             sscanf(product, "%*x/%4x/%4x/%*x", &usb_vendor, &usb_model) == 2) {
@@ -143,6 +139,17 @@ device_added(struct udev_device *udev_device)
             else
                 LOG_PROPERTY(ppath, "PRODUCT", product);
         }
+
+        while (!pnp_id && (parent = udev_device_get_parent(parent))) {
+            pnp_id = udev_device_get_sysattr_value(parent, "id");
+            if (!pnp_id)
+                continue;
+
+            attrs.pnp_id = strdup(pnp_id);
+            ppath = udev_device_get_devnode(parent);
+            LOG_SYSATTR(ppath, "id", pnp_id);
+        }
+
     }
     if (!name)
         name = "(unnamed)";
commit 2cbbe80efc485d2d05b06efe1e2e01f81f3e06f6
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Feb 20 13:18:05 2014 +1000

    Xi: check for invalid modifiers for XI2 passive grabs
    
    The other values are checked correctly, but if a modifier was outside the
    allowed range, it would go unnoticed and cause a out-of-bounds read error for
    any mask equal or larger than 256. The DetailRec where we store the grab masks
    is only sized to 8 * sizeof(Mask).
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Reviewed-by: Alan Coopersmith <alan.coopersmith at oracle.com>
    (cherry picked from commit 0f10cfd4b903d4db293ec47c8a9a0d8b33965803)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 528e105..ad02650 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -2183,7 +2183,8 @@ CheckGrabValues(ClientPtr client, GrabParameters *param)
         return BadValue;
     }
 
-    if (param->grabtype != XI2 && (param->modifiers != AnyModifier) &&
+    if (param->modifiers != AnyModifier &&
+        param->modifiers != XIAnyModifier &&
         (param->modifiers & ~AllModifiersMask)) {
         client->errorValue = param->modifiers;
         return BadValue;
diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c
index 8aba977..700622d 100644
--- a/Xi/xipassivegrab.c
+++ b/Xi/xipassivegrab.c
@@ -189,6 +189,10 @@ ProcXIPassiveGrabDevice(ClientPtr client)
         uint8_t status = Success;
 
         param.modifiers = *modifiers;
+        ret = CheckGrabValues(client, &param);
+        if (ret != Success)
+            goto out;
+
         switch (stuff->grab_type) {
         case XIGrabtypeButton:
             status = GrabButton(client, dev, mod_dev, stuff->detail,
commit b3656c0b52d57333c64f932676a237d0f3a97f36
Author: Mark Kettenis <kettenis at openbsd.org>
Date:   Sun Dec 15 14:31:10 2013 +0100

    sync: Avoid ridiculously long timeouts
    
    On OpenBSD, passing a timeout longer than 100000000 seconds to select(2) will
    make it fail with EINVAL.  As this is original 4.4BSD behaviour it is not
    inconceivable that other systems suffer from the same problem.  And Linux,
    though not suffering from any 4.4BSD heritage, briefly did something similar:
    
    <https://lkml.org/lkml/2012/8/31/263>
    
    So avoid calling AdjustWaitForDelay() instead of setting the timeout to
    (effectively) ULONG_MAX milliseconds.
    
    Signed-off-by: Mark Kettenis <kettenis at openbsd.org>
    Reviewed-by: Matthieu Herrb <matthieu at herrb.eu>
    (cherry picked from commit ddeca927498c9df3b5e62c7bf05e31e2a3aeaa52)

diff --git a/Xext/sync.c b/Xext/sync.c
index 2d58ea1..c33b5b5 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -2731,27 +2731,24 @@ IdleTimeBlockHandler(pointer pCounter, struct timeval **wt, pointer LastSelectMa
          * If we've been idle more than it, and someone wants to know about
          * that level-triggered, schedule an immediate wakeup.
          */
-        unsigned long timeout = -1;
 
         if (XSyncValueLessThan(idle, *greater)) {
             XSyncValue value;
             Bool overflow;
 
             XSyncValueSubtract(&value, *greater, idle, &overflow);
-            timeout = min(timeout, XSyncValueLow32(value));
+            AdjustWaitForDelay(wt, XSyncValueLow32(value));
         }
         else {
             for (list = counter->sync.pTriglist; list;
                  list = list->next) {
                 trig = list->pTrigger;
                 if (trig->CheckTrigger(trig, old_idle)) {
-                    timeout = min(timeout, 0);
+                    AdjustWaitForDelay(wt, 0);
                     break;
                 }
             }
         }
-
-        AdjustWaitForDelay(wt, timeout);
     }
 
     counter->value = old_idle;  /* pop */


More information about the xorg-commit mailing list