Fix Config record allocation during startup: if xorg.conf.d directory
- was absent, a segfault resulted.
This commit is contained in:
parent
d66825093a
commit
0af4a5b7d3
87
0001-Fix-segfault-if-xorg.conf.d-is-absent.patch
Normal file
87
0001-Fix-segfault-if-xorg.conf.d-is-absent.patch
Normal file
@ -0,0 +1,87 @@
|
||||
From c5bd98b820d7bd2c486daaaa919a4eda710fde6c Mon Sep 17 00:00:00 2001
|
||||
From: Fedora X Ninjas <x@fedoraproject.org>
|
||||
Date: Fri, 28 Oct 2016 13:46:17 -0400
|
||||
Subject: [PATCH] Fix segfault if xorg.conf.d is absent
|
||||
|
||||
---
|
||||
hw/xfree86/common/xf86AutoConfig.c | 9 +++++++++
|
||||
hw/xfree86/parser/read.c | 16 +++++++++++++++-
|
||||
hw/xfree86/parser/xf86Parser.h | 1 +
|
||||
3 files changed, 25 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/hw/xfree86/common/xf86AutoConfig.c b/hw/xfree86/common/xf86AutoConfig.c
|
||||
index 9402651..c3e17be 100644
|
||||
--- a/hw/xfree86/common/xf86AutoConfig.c
|
||||
+++ b/hw/xfree86/common/xf86AutoConfig.c
|
||||
@@ -149,6 +149,15 @@ xf86AutoConfig(void)
|
||||
char buf[1024];
|
||||
ConfigStatus ret;
|
||||
|
||||
+ /* Make sure config rec is there */
|
||||
+ if (xf86allocateConfig() != NULL) {
|
||||
+ ret = CONFIG_OK; /* OK so far */
|
||||
+ }
|
||||
+ else {
|
||||
+ xf86Msg(X_ERROR, "Couldn't allocate Config record.\n");
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
listPossibleVideoDrivers(deviceList, 20);
|
||||
|
||||
for (p = deviceList; *p; p++) {
|
||||
diff --git a/hw/xfree86/parser/read.c b/hw/xfree86/parser/read.c
|
||||
index ec038ae..d7e7312 100644
|
||||
--- a/hw/xfree86/parser/read.c
|
||||
+++ b/hw/xfree86/parser/read.c
|
||||
@@ -56,6 +56,7 @@
|
||||
#include <xorg-config.h>
|
||||
#endif
|
||||
|
||||
+#include "xf86Config.h"
|
||||
#include "xf86Parser.h"
|
||||
#include "xf86tokens.h"
|
||||
#include "Configint.h"
|
||||
@@ -91,7 +92,7 @@ xf86readConfigFile(void)
|
||||
int token;
|
||||
XF86ConfigPtr ptr = NULL;
|
||||
|
||||
- if ((ptr = calloc(1, sizeof(XF86ConfigRec))) == NULL) {
|
||||
+ if ((ptr = xf86allocateConfig()) == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -270,6 +271,19 @@ xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2)
|
||||
return (!(last_1 == last_2));
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Conditionally allocate config struct, but only allocate it
|
||||
+ * if it's not already there. In either event, return the pointer
|
||||
+ * to the global config struct.
|
||||
+ */
|
||||
+XF86ConfigPtr xf86allocateConfig(void)
|
||||
+{
|
||||
+ if (!xf86configptr) {
|
||||
+ xf86configptr = calloc(1, sizeof(XF86ConfigRec));
|
||||
+ }
|
||||
+ return xf86configptr;
|
||||
+}
|
||||
+
|
||||
void
|
||||
xf86freeConfig(XF86ConfigPtr p)
|
||||
{
|
||||
diff --git a/hw/xfree86/parser/xf86Parser.h b/hw/xfree86/parser/xf86Parser.h
|
||||
index ff35846..9c4b403 100644
|
||||
--- a/hw/xfree86/parser/xf86Parser.h
|
||||
+++ b/hw/xfree86/parser/xf86Parser.h
|
||||
@@ -449,6 +449,7 @@ extern char *xf86openConfigDirFiles(const char *path, const char *cmdline,
|
||||
extern void xf86setBuiltinConfig(const char *config[]);
|
||||
extern XF86ConfigPtr xf86readConfigFile(void);
|
||||
extern void xf86closeConfigFile(void);
|
||||
+extern XF86ConfigPtr xf86allocateConfig(void);
|
||||
extern void xf86freeConfig(XF86ConfigPtr p);
|
||||
extern int xf86writeConfigFile(const char *, XF86ConfigPtr);
|
||||
extern _X_EXPORT XF86ConfDevicePtr xf86findDevice(const char *ident,
|
||||
--
|
||||
2.7.4
|
||||
|
@ -45,7 +45,7 @@
|
||||
Summary: X.Org X11 X server
|
||||
Name: xorg-x11-server
|
||||
Version: 1.19.0
|
||||
Release: 0.5%{?gitdate:.%{gitdate}}%{dist}
|
||||
Release: 0.6%{?gitdate:.%{gitdate}}%{dist}
|
||||
URL: http://www.x.org
|
||||
License: MIT
|
||||
Group: User Interface/X
|
||||
@ -87,6 +87,7 @@ Patch6: 0006-xfree86-Try-harder-to-find-atleast-1-non-GPU-Screen.patch
|
||||
Patch7: 0007-inputthread-On-Linux-leave-the-main-thread-s-name-as.patch
|
||||
Patch8: 0008-ramdac-Check-sPriv-NULL-in-xf86CheckHWCursor.patch
|
||||
Patch9: 0009-xwayland-Activate-and-enable-touch-devices.patch
|
||||
Patch10: 0001-Fix-segfault-if-xorg.conf.d-is-absent.patch
|
||||
|
||||
#Patch6044: xserver-1.6.99-hush-prerelease-warning.patch
|
||||
|
||||
@ -591,6 +592,10 @@ find %{inst_srcdir}/hw/xfree86 -name \*.c -delete
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue Nov 1 2016 Ben Crocker <bcrocker@redhat.com> - 1.19.0-0.6.20161028
|
||||
- Fix Config record allocation during startup: if xorg.conf.d directory
|
||||
- was absent, a segfault resulted.
|
||||
|
||||
* Mon Oct 31 2016 Adam Jackson <ajax@redhat.com> - 1.19.0-0.5.20161026
|
||||
- Use %%autopatch instead of doing our own custom git-am trick
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user