xf86-video-intel: src/sna/sna_display.c
Chris Wilson
ickle at kemper.freedesktop.org
Fri Feb 14 15:58:17 CET 2014
src/sna/sna_display.c | 7 +++++++
1 file changed, 7 insertions(+)
New commits:
commit 37dbd669415ac82a79b3699da0450aaf68cb1c4c
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Fri Feb 14 14:53:14 2014 +0000
sna: Check that the backlight interface is in sysfs before access
Before we write values into the file, we want to be sure that it is our
sysfs backlight interface, and not some ordinary file we are about to
destroy.
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 521d4ef..15b27e4 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -445,6 +445,7 @@ sna_output_backlight_get_max(xf86OutputPtr output)
{
struct sna_output *sna_output = output->driver_private;
char path[1024], val[BACKLIGHT_VALUE_LEN];
+ struct stat st;
int fd, max = 0;
/* We are used as an initial check to see if we can
@@ -455,6 +456,12 @@ sna_output_backlight_get_max(xf86OutputPtr output)
if (access(path, R_OK | W_OK))
return -1;
+ if (stat(path, &st))
+ return -1;
+
+ if (major(st.st_dev)) /* is this a kernel psuedo filesystem? */
+ return -1;
+
sprintf(path, "%s/%s/max_brightness",
BACKLIGHT_CLASS, sna_output->backlight_iface);
fd = open(path, O_RDONLY);
More information about the xorg-commit
mailing list