forked from Minki/linux
This contains a fix to restrict what lessee can do with masters and
another one when waiting for timeouts on reservation objects. -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJacduMAAoJEEN0HIUfOBk0y5IQALpys8ycG3b5Wm5Qz/ftKr3b YfhVx2kRXSPKLWutKN+Mseo4hNKhbrk6MsLctlXOAKLGCIG9cs8erwB4bQm+a7sX 3LTx9QNRIQsSK09bVY+MGrfSjbTcyzDVC2qCk/4w6F53jRVlvZZpZ2JZQ/OeRihK F9Jg37P2TyXfJbS5xq3rP7N18+0TwdIZcUhqSYenTrpXJIguWqL8w836v+GD/cJA 3DqfzQI+TSNiY9uAT76BAz1x7GOqecf5Cd5G7Sag4z9IeutqIrnt3+hcl7fZ3a2v CwY+TmTzu9GO0WOG2J8Az0/p0B9nr3OaYlSILMQ9fvVwGNY1Y8wF94SLrjEapMsu wv1X5V5/nwUOqWPbZZJNP1849PYuI7oTOZcrB013lrA+AE/yCxF+2XuF4u/GPMvf ULmXll8D2+bWq4Oqv0dJFPXYGvAj+5Ksn9yin0CDW+g2cHe1JQRGjitajd40usPh qBHr7Q7ARyWX7MccGQUx5nYHNCp7su5ofNPlX5aTi8CeUiTp8py1xAYCzzyULDBA ScHIWz83dc2f/Kq65g8lBQotfSPCqcKpduv4/bkvu+tqMSxI1NEaGQ/iQpWzsI8v PwMl7dbQRp66iN2VxNtvkdEcVLfOBofKowU/exD7eSY7tuQLhb7YpwLHMAJYzUhn J/f2NiZMFDCXzUHAranR =h8qb -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
7ec3c0957f
@ -471,13 +471,15 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj,
|
||||
unsigned long timeout)
|
||||
{
|
||||
struct dma_fence *fence;
|
||||
unsigned seq, shared_count, i = 0;
|
||||
unsigned seq, shared_count;
|
||||
long ret = timeout ? timeout : 1;
|
||||
int i;
|
||||
|
||||
retry:
|
||||
shared_count = 0;
|
||||
seq = read_seqcount_begin(&obj->seq);
|
||||
rcu_read_lock();
|
||||
i = -1;
|
||||
|
||||
fence = rcu_dereference(obj->fence_excl);
|
||||
if (fence && !test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags)) {
|
||||
@ -493,14 +495,14 @@ retry:
|
||||
fence = NULL;
|
||||
}
|
||||
|
||||
if (!fence && wait_all) {
|
||||
if (wait_all) {
|
||||
struct reservation_object_list *fobj =
|
||||
rcu_dereference(obj->fence);
|
||||
|
||||
if (fobj)
|
||||
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]);
|
||||
|
||||
if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
|
||||
|
@ -230,6 +230,12 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
|
||||
if (!dev->master)
|
||||
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;
|
||||
drm_drop_master(dev, file_priv);
|
||||
out_unlock:
|
||||
|
Loading…
Reference in New Issue
Block a user