summaryrefslogtreecommitdiffstats
path: root/drivers/accel
diff options
context:
space:
mode:
authorPranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com>2023-05-17 21:35:37 +0200
committerJeffrey Hugo <quic_jhugo@quicinc.com>2023-05-23 17:48:19 +0200
commit2e0904efc945ed5b04a9b251b9cefdd6754f5e15 (patch)
tree72a5d82ba887f53c3947add8a6716a78f46eb410 /drivers/accel
parentaccel/qaic: Validate user data before grabbing any lock (diff)
downloadlinux-2e0904efc945ed5b04a9b251b9cefdd6754f5e15.tar.xz
linux-2e0904efc945ed5b04a9b251b9cefdd6754f5e15.zip
accel/qaic: Validate if BO is sliced before slicing
QAIC_ATTACH_SLICE_BO attaches slicing configuration to a BO. Validate if given BO is already sliced. An already sliced BO cannot be sliced again. Fixes: ff13be830333 ("accel/qaic: Add datapath") Signed-off-by: Pranjal Ramajor Asha Kanojiya <quic_pkanojiy@quicinc.com> Reviewed-by: Carl Vanderlip <quic_carlv@quicinc.com> Reviewed-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Signed-off-by: Jeffrey Hugo <quic_jhugo@quicinc.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230517193540.14323-3-quic_jhugo@quicinc.com
Diffstat (limited to 'drivers/accel')
-rw-r--r--drivers/accel/qaic/qaic_data.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
index 5f71d76dd3a6..e672dd244703 100644
--- a/drivers/accel/qaic/qaic_data.c
+++ b/drivers/accel/qaic/qaic_data.c
@@ -1001,6 +1001,11 @@ int qaic_attach_slice_bo_ioctl(struct drm_device *dev, void *data, struct drm_fi
bo = to_qaic_bo(obj);
+ if (bo->sliced) {
+ ret = -EINVAL;
+ goto put_bo;
+ }
+
ret = qaic_prepare_bo(qdev, bo, &args->hdr);
if (ret)
goto put_bo;