[PATCH] dix: fix crashers with floating device.
Peter Hutterer
peter.hutterer at who-t.net
Mon Jun 6 18:01:24 PDT 2011
dc57f89959e549403f8488eb9f23425bd7118b22 accidentally reversed the
conditions.
in dix/events.c we try to detach floating devices. This leads to a
NULL-dereference on GetMaster()->id.
in dix/getevents.c we try to get the master device for the floating slave
and dereference it.
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
dix/events.c | 2 +-
dix/getevents.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dix/events.c b/dix/events.c
index 6660504..6b74b1a 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1421,7 +1421,7 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
static void
DetachFromMaster(DeviceIntPtr dev)
{
- if (!IsFloating(dev))
+ if (IsFloating(dev))
return;
dev->saved_master_id = GetMaster(dev, MASTER_ATTACHED)->id;
diff --git a/dix/getevents.c b/dix/getevents.c
index 1352a81..c935c97 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -864,7 +864,7 @@ positionSprite(DeviceIntPtr dev, int mode,
* to the current screen. */
miPointerSetPosition(dev, mode, screenx, screeny);
- if(!IsMaster(dev) || !IsFloating(dev)) {
+ if(!IsMaster(dev) && !IsFloating(dev)) {
DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
master->last.valuators[0] = *screenx;
master->last.valuators[1] = *screeny;
@@ -911,7 +911,7 @@ updateHistory(DeviceIntPtr dev, ValuatorMask *mask, CARD32 ms)
return;
updateMotionHistory(dev, ms, mask, dev->last.valuators);
- if(!IsMaster(dev) || !IsFloating(dev))
+ if(!IsMaster(dev) && !IsFloating(dev))
{
DeviceIntPtr master = GetMaster(dev, MASTER_POINTER);
updateMotionHistory(master, ms, mask, dev->last.valuators);
--
1.7.5.1
More information about the xorg-devel
mailing list