drm: move lease init after validation in drm_lease_create
authorKeith Packard <keithp@keithp.com>
Thu, 21 Dec 2017 06:54:24 +0000 (22:54 -0800)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 21 Dec 2017 08:49:40 +0000 (09:49 +0100)
commitd2a48e52541cdf474ef35d51e8d73ded5be33122
tree9a722b300870bd111d323e2131dd0aca6715d851
parentce0769e0ea4b3e192466243a1a9fd39acf214f1e
drm: move lease init after validation in drm_lease_create

Patch bd36d3bab2e3d08f80766c86487090dbceed4651 fixed a deadlock in the
failure path of drm_lease_create. This made the partially initialized
lease object visible for a short window of time.

To avoid having the lessee state appear transiently, I've rearranged
the code so that the lessor fields are not filled in until the
parameters are all validated and the function will succeed.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20171221065424.1304-1-keithp@keithp.com
drivers/gpu/drm/drm_lease.c