Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b018fcda authored by Eric Anholt's avatar Eric Anholt Committed by Dave Airlie
Browse files

drm: Make DRM_IOCTL_GET_CLIENT return EINVAL when it can't find client #idx.



Fixes the getclient test and dritest -c.

Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 3260f9fd
Loading
Loading
Loading
Loading
+11 −14
Original line number Diff line number Diff line
@@ -235,17 +235,9 @@ int drm_getclient(struct drm_device *dev, void *data,
	idx = client->idx;
	mutex_lock(&dev->struct_mutex);

	if (list_empty(&dev->filelist)) {
		mutex_unlock(&dev->struct_mutex);
		return -EINVAL;
	}

	i = 0;
	list_for_each_entry(pt, &dev->filelist, lhead) {
		if (i++ >= idx)
			break;
	}

		if (i++ >= idx) {
			client->auth = pt->authenticated;
			client->pid = pt->pid;
			client->uid = pt->uid;
@@ -255,6 +247,11 @@ int drm_getclient(struct drm_device *dev, void *data,

			return 0;
		}
	}
	mutex_unlock(&dev->struct_mutex);

	return -EINVAL;
}

/**
 * Get statistics information.