]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
accel/amdxdna: reject command submission on devices without a submit op
authorDoruk Tan Ozturk <doruk@0sec.ai>
Mon, 13 Jul 2026 17:30:29 +0000 (19:30 +0200)
committerLizhi Hou <lizhi.hou@amd.com>
Wed, 15 Jul 2026 01:09:08 +0000 (18:09 -0700)
amdxdna_cmd_submit() calls xdna->dev_info->ops->cmd_submit()
unconditionally, but only aie2_dev_ops defines that callback.
aie4_vf_ops (the AIE4 SR-IOV virtual function) does not, so a user
AMDXDNA_EXEC_CMD ioctl on an AIE4 device reaches a NULL function-pointer
call and oopses the kernel. AIE4 submits work through a mapped user queue
and doorbell, not this ioctl path.

Reject the submission early with -EOPNOTSUPP when the device provides no
cmd_submit op, so the shared EXEC ioctl is a clean no-op on such devices.

Fixes: aac243092b70 ("accel/amdxdna: Add command execution")
Cc: stable@vger.kernel.org
Found by 0sec automated security-research tooling (https://0sec.ai).
Assisted-by: 0sec:claude-opus-4-8
Signed-off-by: Doruk Tan Ozturk <doruk@0sec.ai>
Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260713173030.87541-3-doruk@0sec.ai
drivers/accel/amdxdna/amdxdna_ctx.c

index a5c8c2c4de6d9145cf682c938c38c877897cf00d..bdbd3db12a6c32bf1fa0f36fefc279ae00417de1 100644 (file)
@@ -590,6 +590,10 @@ int amdxdna_cmd_submit(struct amdxdna_client *client,
        int ret, idx;
 
        XDNA_DBG(xdna, "Command BO hdl %d, Arg BO count %d", cmd_bo_hdl, arg_bo_cnt);
+
+       if (!xdna->dev_info->ops->cmd_submit)
+               return -EOPNOTSUPP;
+
        job = kzalloc_flex(*job, bos, arg_bo_cnt);
        if (!job)
                return -ENOMEM;