summaryrefslogtreecommitdiff
path: root/xf86drm.c
diff options
context:
space:
mode:
authorTobias Jakobi <tjakobi@math.uni-bielefeld.de>2023-12-25 00:21:44 +0100
committerSimon Ser <contact@emersion.fr>2024-02-08 14:23:52 +0000
commit7ab1cdac9013d2a4c41b3d0975f953585517cfa1 (patch)
tree74bb8aa0e76f58d89e57abeae41a3619a48bd697 /xf86drm.c
parent140943281ba1fc2bd6a1140d4c26c7595c0d6abf (diff)
xf86drm: ignore symlinks in process_device()103-regression-intel-mesa-buildtests-broken-by-libdrm-update
If the user has some UDev rules in place that creates symlinks for one of the card or render nodes, and the name of the symlink is too long, then drmDeviceAlloc() ends up truncating the name of the node. This in turn results in chaos in different subsystems. E.g. vulkaninfo dies early with this: Code 0 : failed to stat DRM primary node /dev/dri/my-favorite- (VK_ERROR_INITIALIZATION_FAILED) (if the symlink is called /dev/dri/my-favorite-card-node) Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
Diffstat (limited to 'xf86drm.c')
-rw-r--r--xf86drm.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/xf86drm.c b/xf86drm.c
index 2e76f0ea..150c6095 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -4479,7 +4479,10 @@ process_device(drmDevicePtr *device, const char *d_name,
return -1;
snprintf(node, PATH_MAX, "%s/%s", DRM_DIR_NAME, d_name);
- if (stat(node, &sbuf))
+ if (lstat(node, &sbuf))
+ return -1;
+
+ if (S_ISLNK(sbuf.st_mode))
return -1;
maj = major(sbuf.st_rdev);