virgl: Bail out on file descriptor duplication failure

Do not try to use a negative file descriptor.

CID: 1465120 Argument cannot be negative

Signed-off-by: Corentin Noël <corentin.noel@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34816>
This commit is contained in:
Corentin Noël 2025-05-05 15:58:00 +02:00 committed by Marge Bot
parent 965f41b550
commit 77c0ff9fc7

View file

@ -1364,6 +1364,8 @@ virgl_drm_screen_create(int fd, const struct pipe_screen_config *config)
} else {
struct virgl_winsys *vws;
int dup_fd = os_dupfd_cloexec(fd);
if (dup_fd < 0)
goto unlock;
vws = virgl_drm_winsys_create(dup_fd);
if (!vws) {