From b6c16fc7dad5a4ffcaaab647c0e3fabed372efd5 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 5 Jun 2009 11:57:39 +1000 Subject: [PATCH] crtc/gamma: check xf86_config is valid before using it. If you have multiple cards, some that support randr 1.2 and some that don't you can get a null dereference in here. Signed-off-by: Dave Airlie --- hw/xfree86/modes/xf86Crtc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 0ab2f3df9..b40e09605 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -3140,6 +3140,9 @@ xf86_crtc_supports_gamma(ScrnInfoPtr pScrn) xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn); xf86CrtcPtr crtc; + /* for multiple drivers loaded we need this */ + if (!xf86_config) + return FALSE; if (xf86_config->num_crtc == 0) return FALSE; crtc = xf86_config->crtc[0];