xserver-multidpi/hw/xfree86/parser
Ben Crocker 8cf47472bf Fix a segfault that occurs if xorg.conf.d is absent:
In InitOutput, if xf86HandleConfigFile returns CONFIG_NOFILE
(which it does if no config file or directory is present), the
autoconfig flag is set, causing xf86AutoConfig to be called
later on.

xf86AutoConfig calls xf86OutputClassDriverList via the
call tree:

xf86AutoConfig =>
  listPossibleVideoDrivers =>
    xf86PlatformMatchDriver =>
      xf86OutputClassDriverList

and xf86OutputClassDriverList attempts to traverse a linked list
that is a member of the XF86ConfigRec struct pointed to by the
global xf86configptr, which is NULL at this point because the
XF86ConfigRec struct is only allocated (by xf86readConfigFile)
AFTER the config file and directory have been successfully
opened; the CONFIG_NOFILE return from xf86HandleConfigFile
occurs BEFORE the call to xf86readConfigFile which allocates
the XF86ConfigRec struct.

Rx: In read.c (for symmetry with xf86freeConfig, which already
appears in this file), add a new function xf86allocateConfig
which tests the value of xf86configptr and, if it's NULL,
allocates the XF86ConfigRec struct and deposits the pointer
in xf86configptr.  In xf86Parser.h, add a prototype for the
new xf86allocateConfig function.

Back in read.c, #include "xf86Config.h".  In xf86readConfigFile,
change the open-code call to calloc to a call to the new
xf86allocateConfig function.

In xf86AutoConfig.c, add a call to the new xf86allocateConfig function
to the beginning of xf86AutoConfig to make sure the XF86ConfigRec struct
is allocated.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
(cherry picked from commit 8b335d9068)
2017-01-11 15:00:58 -05:00
..
Configint.h xserver: add xorg.conf support for gpu devices. (v2.1) 2015-04-27 13:40:40 +10:00
configProcs.h xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
Device.c xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
DRI.c xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
Extensions.c xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
Files.c xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
Flags.c xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
Input.c xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
InputClass.c xfree86: add support for MatchIsTabletPad 2016-05-03 16:15:51 +10:00
Layout.c xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
Makefile.am libxf86config: libxf86config_internal -> libxf86config 2015-09-23 14:29:21 -04:00
Module.c xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
Monitor.c xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
OutputClass.c xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
Pointer.c xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
read.c Fix a segfault that occurs if xorg.conf.d is absent: 2017-01-11 15:00:58 -05:00
scan.c xfree86/parser: reuse StringToToken() in xf86getToken() 2016-04-18 11:36:43 -04:00
Screen.c xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
Vendor.c xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
Video.c xfree86/parser: annotate xf86ConfigSymTabRec as constant data 2016-04-18 11:36:29 -04:00
write.c dix: Use OsSignal() not signal() 2016-06-08 11:36:31 -04:00
xf86Optrec.h Drop trailing whitespaces 2014-11-12 10:25:00 +10:00
xf86Parser.h Fix a segfault that occurs if xorg.conf.d is absent: 2017-01-11 15:00:58 -05:00
xf86tokens.h xfree86: add support for MatchIsTabletPad 2016-05-03 16:15:51 +10:00