OSDN Git Service

nouveau: dup fd before passing it to device
authorIlia Mirkin <imirkin@alum.mit.edu>
Thu, 19 Jun 2014 08:25:04 +0000 (04:25 -0400)
committerIlia Mirkin <imirkin@alum.mit.edu>
Tue, 24 Jun 2014 13:30:25 +0000 (09:30 -0400)
commita59f2bb17bcc78e09653391748549e7973990798
treec70b75e42d89d412d6633d275835618a313edfda
parent41d759d076737f94976f5294b734dbc437a12bae
nouveau: dup fd before passing it to device

nouveau screens are reused for the same device node. However in the
scenario where we create screen 1, screen 2, and then delete screen 1,
the surrounding code might also close the original device node. To
protect against this, dup the fd and use the dup'd fd in the
nouveau_device. Also tell the nouveau_device that it is the owner of the
fd so that it will be closed on destruction.

Also make sure to free the nouveau_device in case of any failure.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79823
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Cc: "10.2" <mesa-stable@lists.freedesktop.org>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
src/gallium/winsys/nouveau/drm/nouveau_drm_winsys.c