]> git.baikalelectronics.ru Git - kernel.git/commit
drm: Use array_size() when creating lease
authorMatthew Wilcox <willy@infradead.org>
Thu, 14 Feb 2019 19:03:48 +0000 (11:03 -0800)
committerDave Airlie <airlied@redhat.com>
Fri, 15 Feb 2019 03:08:08 +0000 (13:08 +1000)
commitd60d0b6c9dbfd02f29dbe3c7f6e0ea1b39461c64
tree2e231c985a2670be1966b1f81c92004641ba3736
parent5870e2d7516c50b66e665ca35e78a13d96a1b259
drm: Use array_size() when creating lease

Passing an object_count of sufficient size will make
object_count * 4 wrap around to be very small, then a later function
will happily iterate off the end of the object_ids array.  Using
array_size() will saturate at SIZE_MAX, the kmalloc() will fail and
we'll return an -ENOMEM to the norty userspace.

Fixes: a6840b4fdea5 ("drm: Add four ioctls for managing drm mode object leases [v7]")
Signed-off-by: Matthew Wilcox <willy@infradead.org>
Acked-by: Kees Cook <keescook@chromium.org>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: <stable@vger.kernel.org> # v4.15+
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_lease.c