xf86drm: drmGetDevice2: error out if the fd has unknown subsys

Currently one can open() any /dev node. If it's unknown
drmParseSubsystemType() will return an error.

Track that and bail as needed.

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Robert Foss <robert.foss@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
main
Emil Velikov 2018-05-15 16:43:58 +01:00 committed by Emil Velikov
parent 4fa33e45e6
commit 7f52a0ebf7
1 changed files with 2 additions and 0 deletions

View File

@ -3814,6 +3814,8 @@ int drmGetDevice2(int fd, uint32_t flags, drmDevicePtr *device)
return -EINVAL;
subsystem_type = drmParseSubsystemType(maj, min);
if (subsystem_type < 0)
return subsystem_type;
local_devices = calloc(max_count, sizeof(drmDevicePtr));
if (local_devices == NULL)