modesetting: Do not close uninitialized dri2 screen
If a dri2 screen is not successfully initialized, attempting to close it results in a null dereference. Maintain a flag indicating whether the dri2 screen was successfully initialized, and check it before attempting to close the dri2 screen. https://bugzilla.redhat.com/show_bug.cgi?id=1485811 https://bugzilla.redhat.com/show_bug.cgi?id=1493805 https://bugzilla.redhat.com/show_bug.cgi?id=1534459 https://bugzilla.redhat.com/show_bug.cgi?id=1541745 https://bugs.freedesktop.org/show_bug.cgi?id=101282 Signed-off-by: Jeff Smith <whydoubt@gmail.com>
This commit is contained in:
parent
aa29298416
commit
9227237806
|
@ -1685,12 +1685,12 @@ ScreenInit(ScreenPtr pScreen, int argc, char **argv)
|
|||
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
if (ms->drmmode.glamor) {
|
||||
if (!ms_dri2_screen_init(pScreen)) {
|
||||
if (!(ms->drmmode.dri2_enable = ms_dri2_screen_init(pScreen))) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
"Failed to initialize the DRI2 extension.\n");
|
||||
}
|
||||
|
||||
if (!ms_present_screen_init(pScreen)) {
|
||||
if (!(ms->drmmode.present_enable = ms_present_screen_init(pScreen))) {
|
||||
xf86DrvMsg(pScrn->scrnIndex, X_ERROR,
|
||||
"Failed to initialize the Present extension.\n");
|
||||
}
|
||||
|
@ -1783,7 +1783,7 @@ CloseScreen(ScreenPtr pScreen)
|
|||
ms_ent->assigned_crtcs = 0;
|
||||
|
||||
#ifdef GLAMOR_HAS_GBM
|
||||
if (ms->drmmode.glamor) {
|
||||
if (ms->drmmode.dri2_enable) {
|
||||
ms_dri2_close_screen(pScreen);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -83,6 +83,9 @@ typedef struct {
|
|||
|
||||
Bool dri2_flipping;
|
||||
Bool present_flipping;
|
||||
|
||||
Bool dri2_enable;
|
||||
Bool present_enable;
|
||||
} drmmode_rec, *drmmode_ptr;
|
||||
|
||||
typedef struct {
|
||||
|
|
Loading…
Reference in New Issue