Backport cf7517675d988c2d1ff967d6d162a17acbdad46 from xserver 1.20

xfree86: Hold input_lock across SPRITE functions in VGA arbiter

Fixes stack overflow crash with VGA arbiter used with multi GPU systems.
Report and fix identified by 'Joe M' on misc@. ok matthieu@
This commit is contained in:
jsg 2019-04-28 03:12:53 +00:00
parent e0064514d7
commit 4fd0ec7f37

View File

@ -73,14 +73,20 @@
#define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x #define UNWRAP_SCREEN_INFO(x) pScrn->x = pScreenPriv->x
#define SPRITE_PROLOG miPointerScreenPtr PointPriv = \ #define SPRITE_PROLOG \
(miPointerScreenPtr)dixLookupPrivate(&pScreen->devPrivates, \ miPointerScreenPtr PointPriv; \
miPointerScreenKey); VGAarbiterScreenPtr pScreenPriv = \ VGAarbiterScreenPtr pScreenPriv; \
((VGAarbiterScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \ input_lock(); \
VGAarbiterScreenKey)); PointPriv->spriteFuncs = pScreenPriv->miSprite; PointPriv = dixLookupPrivate(&pScreen->devPrivates, \
miPointerScreenKey); \
pScreenPriv = dixLookupPrivate(&(pScreen)->devPrivates, \
VGAarbiterScreenKey); \
PointPriv->spriteFuncs = pScreenPriv->miSprite; \
#define SPRITE_EPILOG pScreenPriv->miSprite = PointPriv->spriteFuncs;\ #define SPRITE_EPILOG \
PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; pScreenPriv->miSprite = PointPriv->spriteFuncs; \
PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \
input_unlock();
#define WRAP_SPRITE do { pScreenPriv->miSprite = PointPriv->spriteFuncs;\ #define WRAP_SPRITE do { pScreenPriv->miSprite = PointPriv->spriteFuncs;\
PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \ PointPriv->spriteFuncs = &VGAarbiterSpriteFuncs; \