Commit 7ec3c095 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-misc-next-fixes-2018-01-31' of...

Merge tag 'drm-misc-next-fixes-2018-01-31' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

This contains a fix to restrict what lessee can do with masters and
another one when waiting for timeouts on reservation objects.

* tag 'drm-misc-next-fixes-2018-01-31' of git://anongit.freedesktop.org/drm/drm-misc:
  drm: Check for lessee in DROP_MASTER ioctl
  dma-buf: fix reservation_object_wait_timeout_rcu once more v2
parents 559f17be 761e05a7
...@@ -471,13 +471,15 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj, ...@@ -471,13 +471,15 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj,
unsigned long timeout) unsigned long timeout)
{ {
struct dma_fence *fence; struct dma_fence *fence;
unsigned seq, shared_count, i = 0; unsigned seq, shared_count;
long ret = timeout ? timeout : 1; long ret = timeout ? timeout : 1;
int i;
retry: retry:
shared_count = 0; shared_count = 0;
seq = read_seqcount_begin(&obj->seq); seq = read_seqcount_begin(&obj->seq);
rcu_read_lock(); rcu_read_lock();
i = -1;
fence = rcu_dereference(obj->fence_excl); fence = rcu_dereference(obj->fence_excl);
if (fence && !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) { if (fence && !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) {
...@@ -493,14 +495,14 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj, ...@@ -493,14 +495,14 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj,
fence = NULL; fence = NULL;
} }
if (!fence && wait_all) { if (wait_all) {
struct reservation_object_list *fobj = struct reservation_object_list *fobj =
rcu_dereference(obj->fence); rcu_dereference(obj->fence);
if (fobj) if (fobj)
shared_count = fobj->shared_count; shared_count = fobj->shared_count;
for (i = 0; i < shared_count; ++i) { for (i = 0; !fence && i < shared_count; ++i) {
struct dma_fence *lfence = rcu_dereference(fobj->shared[i]); struct dma_fence *lfence = rcu_dereference(fobj->shared[i]);
if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
......
...@@ -230,6 +230,12 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data, ...@@ -230,6 +230,12 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
if (!dev->master) if (!dev->master)
goto out_unlock; goto out_unlock;
if (file_priv->master->lessor != NULL) {
DRM_DEBUG_LEASE("Attempt to drop lessee %d as master\n", file_priv->master->lessee_id);
ret = -EINVAL;
goto out_unlock;
}
ret = 0; ret = 0;
drm_drop_master(dev, file_priv); drm_drop_master(dev, file_priv);
out_unlock: out_unlock:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment