1 From 8407f8a1d940fe28c4243ad4f0cb6a44dcee88f6 Mon Sep 17 00:00:00 2001
2 From: Thomas Hellstrom <thellstrom@vmware.com>
3 Date: Tue, 7 May 2019 11:10:10 +0200
4 Subject: drm/vmwgfx: Fix user space handle equal to zero
6 From: Thomas Hellstrom <thellstrom@vmware.com>
8 commit 8407f8a1d940fe28c4243ad4f0cb6a44dcee88f6 upstream.
10 User-space handles equal to zero are interpreted as uninitialized or
11 illegal by some drm systems (most notably kms). This means that a
12 dumb buffer or surface with a zero user-space handle can never be
13 used as a kms frame-buffer.
15 Cc: <stable@vger.kernel.org>
16 Fixes: c7eae62666ad ("drm/vmwgfx: Make the object handles idr-generated")
17 Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
18 Reviewed-by: Deepak Rawat <drawat@vmware.com>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 drivers/gpu/drm/vmwgfx/ttm_object.c | 2 +-
23 1 file changed, 1 insertion(+), 1 deletion(-)
25 --- a/drivers/gpu/drm/vmwgfx/ttm_object.c
26 +++ b/drivers/gpu/drm/vmwgfx/ttm_object.c
27 @@ -174,7 +174,7 @@ int ttm_base_object_init(struct ttm_obje
28 kref_init(&base->refcount);
29 idr_preload(GFP_KERNEL);
30 spin_lock(&tdev->object_lock);
31 - ret = idr_alloc(&tdev->idr, base, 0, 0, GFP_NOWAIT);
32 + ret = idr_alloc(&tdev->idr, base, 1, 0, GFP_NOWAIT);
33 spin_unlock(&tdev->object_lock);