fbdevhw: Refuse to touch PCI devices on the fallback probe path
Fixes: https://gitlab.freedesktop.org/xorg/driver/xf86-video-fbdev/issues/9
Signed-off-by: Adam Jackson <ajax@redhat.com>
(cherry picked from commit fc78bcca21
)
This commit is contained in:
parent
4795c069a5
commit
f5dc787fc9
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue
Block a user