mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-28 13:20:06 +01:00
ramdac: Check ScreenPriv != NULL in xf86ScreenSetCursor()
Similar to changecba5a10f, xf86ScreenSetCursor() would dereference ScreenPriv without NULL checking it. If Option "SWCursor" is specified, ScreenPriv == NULL. Without this fix, it is observed that setting Option "SWCursor" "on" on the modesetting driver in a PRIME configuration will segfault the server. It is important to return success rather than failure in the instance that ScreenPriv == NULL and pCurs == NullCursor, because otherwise xf86SetCursor() can fall into infinite recursion: xf86SetCursor(pCurs) calls xf86ScreenSetCursor(pCurs), and if FALSE, calls xf86SetCursor(NullCursor). If xf86ScreenSetCursor(NullCursor) returns FALSE, it calls xf86SetCursor(NullCursor) again and this repeats forever. Signed-off-by: Alex Goins <agoins@nvidia.com> Reviewed-by: Dave Airlie <airlied@redhat.com> (cherry picked from commit68d95e759f)
This commit is contained in:
parent
cd5076a50c
commit
4ef1aef0fb
1 changed files with 8 additions and 1 deletions
|
|
@ -180,9 +180,16 @@ xf86ScreenSetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
|
|||
xf86CursorScreenPtr ScreenPriv =
|
||||
(xf86CursorScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
|
||||
xf86CursorScreenKey);
|
||||
xf86CursorInfoPtr infoPtr = ScreenPriv->CursorInfoPtr;
|
||||
|
||||
xf86CursorInfoPtr infoPtr;
|
||||
unsigned char *bits;
|
||||
|
||||
if (!ScreenPriv) { /* NULL if Option "SWCursor" */
|
||||
return (pCurs == NullCursor);
|
||||
}
|
||||
|
||||
infoPtr = ScreenPriv->CursorInfoPtr;
|
||||
|
||||
if (pCurs == NullCursor) {
|
||||
(*infoPtr->HideCursor) (infoPtr->pScrn);
|
||||
return TRUE;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue