]> git.baikalelectronics.ru Git - kernel.git/commit
drm/gem: Always initialize the gem object in object_init
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 20 Jan 2014 07:21:54 +0000 (08:21 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 21 Jan 2014 09:19:58 +0000 (10:19 +0100)
commit280f2542b45d34bc162805e38a28ea357c4310f3
tree21aa3f88cfae5f8db7561094561ca18283316056
parentbb7601d61ab59f1c82041cacafd5e9ffc6d5e5b3
drm/gem: Always initialize the gem object in object_init

At least drm/i915 expects that the obj->dev pointer is set even in
failure paths. Specifically when the shmem initialization fails we
call i915_gem_object_free which needs to deref obj->base.dev to get at
the slab pointer in the device private structure. And the shmem
allocation can easily fail when userspace is hitting open file limits.

Doing the structure init even when the shmem file allocation fails
prevents this Oops.

This is a regression from

commit 0f7dafd3aca9ab37e28e2f77206b823d33d97087
Author: David Herrmann <dh.herrmann@gmail.com>
Date:   Thu Jul 11 11:56:32 2013 +0200

    drm/gem: simplify object initialization

v2: Add regression note which Chris supplied.

Testcase: igt/gem_fd_exhaustion
Reported-and-Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
References: http://lists.freedesktop.org/archives/intel-gfx/2014-January/038433.html
Cc: stable@vger.kernel.org
Reviewed-by: David Herrmann <dh.herrmann@gmail.com>
Cc: David Herrmann <dh.herrmann@gmail.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/drm_gem.c