xserver: Branch 'master' - 2 commits
Keith Packard
keithp at kemper.freedesktop.org
Mon Jul 14 14:05:45 PDT 2014
config/config.c | 32 ++++++++++++++++++++++++++++++++
include/hotplug.h | 4 ++--
2 files changed, 34 insertions(+), 2 deletions(-)
New commits:
commit 4dbb641bb2d4037f107b58b31e80963dc8b72c0e
Author: Hans de Goede <hdegoede at redhat.com>
Date: Mon Jul 14 14:01:47 2014 +0200
config_odev_add_attribute*: Check for right attribute type
Don't allow setting string attributes to integers and vice versa.
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
Reviewed-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/config/config.c b/config/config.c
index 5514516..a26d835 100644
--- a/config/config.c
+++ b/config/config.c
@@ -172,12 +172,38 @@ config_odev_find_or_add_attribute(struct OdevAttributes *attribs, int attrib)
return oa;
}
+static int config_odev_get_attribute_type(int attrib)
+{
+ switch (attrib) {
+ case ODEV_ATTRIB_PATH:
+ case ODEV_ATTRIB_SYSPATH:
+ case ODEV_ATTRIB_BUSID:
+ return ODEV_ATTRIB_STRING;
+ case ODEV_ATTRIB_FD:
+ case ODEV_ATTRIB_MAJOR:
+ case ODEV_ATTRIB_MINOR:
+ return ODEV_ATTRIB_INT;
+ case ODEV_ATTRIB_DRIVER:
+ return ODEV_ATTRIB_STRING;
+ default:
+ LogMessage(X_ERROR, "Error %s called for unknown attribute %d\n",
+ __func__, attrib);
+ return ODEV_ATTRIB_UNKNOWN;
+ }
+}
+
Bool
config_odev_add_attribute(struct OdevAttributes *attribs, int attrib,
const char *attrib_name)
{
struct OdevAttribute *oa;
+ if (config_odev_get_attribute_type(attrib) != ODEV_ATTRIB_STRING) {
+ LogMessage(X_ERROR, "Error %s called for non string attrib %d\n",
+ __func__, attrib);
+ return FALSE;
+ }
+
oa = config_odev_find_or_add_attribute(attribs, attrib);
free(oa->attrib_name);
oa->attrib_name = XNFstrdup(attrib_name);
@@ -191,6 +217,12 @@ config_odev_add_int_attribute(struct OdevAttributes *attribs, int attrib,
{
struct OdevAttribute *oa;
+ if (config_odev_get_attribute_type(attrib) != ODEV_ATTRIB_INT) {
+ LogMessage(X_ERROR, "Error %s called for non integer attrib %d\n",
+ __func__, attrib);
+ return FALSE;
+ }
+
oa = config_odev_find_or_add_attribute(attribs, attrib);
oa->attrib_value = attrib_value;
oa->attrib_type = ODEV_ATTRIB_INT;
diff --git a/include/hotplug.h b/include/hotplug.h
index b2c0d78..4c2fa97 100644
--- a/include/hotplug.h
+++ b/include/hotplug.h
@@ -32,7 +32,7 @@ extern _X_EXPORT void config_pre_init(void);
extern _X_EXPORT void config_init(void);
extern _X_EXPORT void config_fini(void);
-enum { ODEV_ATTRIB_STRING, ODEV_ATTRIB_INT };
+enum { ODEV_ATTRIB_UNKNOWN = -1, ODEV_ATTRIB_STRING = 0, ODEV_ATTRIB_INT };
struct OdevAttribute {
struct xorg_list member;
commit 25eca7ce35973577c8d85704c270f7fb53e6732e
Author: Hans de Goede <hdegoede at redhat.com>
Date: Mon Jul 14 14:01:46 2014 +0200
Fix ODEV_ATTRIB_DRIVER overlapping with ODEV_ATTRIB_FD
Looks like the value of ODEV_ATTRIB_DRIVER was not updated when the patch
adding it got rebased on top of a newer server version.
This fixes the xserver crashing when systemd-logind integration is used.
https://bugzilla.redhat.com/show_bug.cgi?id=1118540
Signed-off-by: Hans de Goede <hdegoede at redhat.com>
Reviewed-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Keith Packard <keithp at keithp.com>
diff --git a/include/hotplug.h b/include/hotplug.h
index c4268a0..b2c0d78 100644
--- a/include/hotplug.h
+++ b/include/hotplug.h
@@ -88,7 +88,7 @@ config_odev_free_attributes(struct OdevAttributes *attribs);
/* Minor number of the device node pointed to by ODEV_ATTRIB_PATH */
#define ODEV_ATTRIB_MINOR 6
/* kernel driver name */
-#define ODEV_ATTRIB_DRIVER 4
+#define ODEV_ATTRIB_DRIVER 7
typedef void (*config_odev_probe_proc_ptr)(struct OdevAttributes *attribs);
void config_odev_probe(config_odev_probe_proc_ptr probe_callback);
More information about the xorg-commit
mailing list