Rob Clark ab5c54cb88 drm/msm: Protect obj->active_count under obj lock
Previously we only held obj lock in the _active_get() path, and relied
on atomic_dec_return() to not be racy in the _active_put() path where
obj lock was not held.

But this is a false sense of security.  Unlike obj lifetime refcnt,
where you do not expect to *increase* the refcnt after the last put
(which would mean that something has gone horribly wrong with the
object liveness reference counting), the active_count can increase
again from zero.  Racing _active_put()s and _active_get()s could leave
the obj on the wrong mm list.

But in the retire path, immediately after the _active_put(), the
_unpin_iova() would acquire obj lock.  So just move the locking earlier
and rely on that to protect obj->active_count.

Fixes: c5c1643cef7a ("drm/msm: Drop struct_mutex from the retire path")
Signed-off-by: Rob Clark <robdclark@chromium.org>
2020-11-21 09:50:23 -08:00
..
2020-07-31 06:46:16 -07:00
2020-07-31 06:46:16 -07:00
2019-09-03 16:17:02 -07:00
2020-11-04 16:00:56 -08:00
2020-11-04 16:00:56 -08:00
2020-11-05 08:39:57 -08:00
2020-10-15 10:46:16 -07:00
2019-09-03 16:16:57 -07:00