Commit f5dc787f authored by Adam Jackson's avatar Adam Jackson 💣

fbdevhw: Refuse to touch PCI devices on the fallback probe path

Fixes: xorg/driver/xf86-video-fbdev#9Signed-off-by: Adam Jackson's avatarAdam Jackson <ajax@redhat.com>
(cherry picked from commit fc78bcca)
parent 4795c069
Pipeline #5628 passed with stage
in 3 minutes and 2 seconds
......@@ -329,6 +329,22 @@ fbdev_open(int scrnIndex, const char *dev, char **namep)
return -1;
}
/* only touch non-PCI devices on this path */
{
char buf[PATH_MAX];
char *sysfs_path = NULL;
char *node = strrchr(dev, '/') + 1;
if (asprintf(&sysfs_path, "/sys/class/graphics/%s", node) < 0 ||
readlink(sysfs_path, buf, sizeof(buf) < 0) ||
strstr(buf, "devices/pci")) {
free(sysfs_path);
close(fd);
return -1;
}
free(sysfs_path);
}
if (namep) {
if (-1 == ioctl(fd, FBIOGET_FSCREENINFO, (void *) (&fix))) {
*namep = NULL;
......
  • Hello, this commit breaks things for me for some reason:

    (II) FBDEV: driver for framebuffer: fbdev
    (II) Loading sub module "fbdevhw"
    (II) LoadModule: "fbdevhw"
    (II) Loading /usr/X11/lib/xorg/modules/libfbdevhw.so
    (II) Module fbdevhw: vendor="X.Org Foundation"
            compiled for 1.20.2, module version = 0.0.2
            ABI class: X.Org Video Driver, version 24.0
    (EE) Unable to find a valid framebuffer device

    On my system I don't have any /sys/bus/pci/devices/*/graphics* entries, but I do have a /dev/fb0:

    -bash-4.4# ls /sys/bus/pci/devices/*/graphics*
    ls: cannot access '/sys/bus/pci/devices/*/graphics*': No such file or directory
    
    -bash-4.4# ls -l /dev/fb0                     
    crw-rw---- 1 root video 29, 0 Oct 19 09:22 /dev/fb0
    
    -bash-4.4# ls -l /sys/class/graphics/         
    total 0
    lrwxrwxrwx 1 root root 0 Oct 19 09:22 fb0 -> ../../devices/platform/vesa-framebuffer.0/graphics/fb0
    lrwxrwxrwx 1 root root 0 Oct 19 09:22 fbcon -> ../../devices/virtual/graphics/fbcon
    
    -bash-4.4# ls -l /sys/class/graphics/fb0/     
    total 0
    -rw-r--r-- 1 root root 4096 Oct 19 09:25 bits_per_pixel
    -rw-r--r-- 1 root root 4096 Oct 19 09:25 bl_curve
    -rw-r--r-- 1 root root 4096 Oct 19 09:25 blank
    -rw-r--r-- 1 root root 4096 Oct 19 09:25 console
    -rw-r--r-- 1 root root 4096 Oct 19 09:25 cursor
    -r--r--r-- 1 root root 4096 Oct 19 09:25 dev
    lrwxrwxrwx 1 root root    0 Oct 19 09:25 device -> ../../../vesa-framebuffer.0
    -rw-r--r-- 1 root root 4096 Oct 19 09:25 mode
    -rw-r--r-- 1 root root 4096 Oct 19 09:25 modes
    -r--r--r-- 1 root root 4096 Oct 19 09:25 name
    -rw-r--r-- 1 root root 4096 Oct 19 09:25 pan
    -rw-r--r-- 1 root root 4096 Oct 19 09:25 rotate
    -rw-r--r-- 1 root root 4096 Oct 19 09:25 state
    -r--r--r-- 1 root root 4096 Oct 19 09:25 stride
    lrwxrwxrwx 1 root root    0 Oct 19 09:25 subsystem -> ../../../../../class/graphics
    -rw-r--r-- 1 root root 4096 Oct 19 09:22 uevent
    -rw-r--r-- 1 root root 4096 Oct 19 09:25 virtual_size

    If you need more information just let me know!

    Regards Christian

    Edited by Christian Schaubschläger
  • I don't understand why this patch would have that effect? We're not looking in /sys/bus/pci, we're looking in /sys/class/graphics.

Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment