drm/msm: Disallow submit with fence id 0

[ Upstream commit 1b5d0ddcb34a605835051ae2950d5cfed0373dd8 ]

A fence id of zero is expected to be invalid, and is not removed from
the fence_idr table.  If userspace is requesting to specify the fence
id with the FENCE_SN_IN flag, we need to reject a zero fence id value.

Fixes: 17154addc5 ("drm/msm: Add MSM_SUBMIT_FENCE_SN_IN")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Patchwork: https://patchwork.freedesktop.org/patch/549180/
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Rob Clark 2023-07-24 13:30:21 -07:00 committed by Greg Kroah-Hartman
parent 3398e8b283
commit a39bf13f86

View File

@ -875,7 +875,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
* after the job is armed * after the job is armed
*/ */
if ((args->flags & MSM_SUBMIT_FENCE_SN_IN) && if ((args->flags & MSM_SUBMIT_FENCE_SN_IN) &&
idr_find(&queue->fence_idr, args->fence)) { (!args->fence || idr_find(&queue->fence_idr, args->fence))) {
spin_unlock(&queue->idr_lock); spin_unlock(&queue->idr_lock);
ret = -EINVAL; ret = -EINVAL;
goto out; goto out;