From: sashiko-bot@kernel.org
To: "Carl Vanderlip" <carl.vanderlip@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 5/6] accel/qaic: Split oversized BO requests into multiple jobs
Date: Sat, 03 Oct 2026 02:51:35 +0000 [thread overview]
Message-ID: <20261003025135.979041F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20261003023818.1161666-6-carl.vanderlip@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] drm/qaic: UAF and double free in create_slice_jobs error path
- [Medium] drm/qaic: sequence number collision breaks DRM scheduler dependencies
- [Medium] drm/qaic: silent failure propagation due to clobbered error code
--
commit 0016fc8438fc80359a88bc33d3c9d6dd42769622
Author: Carl Vanderlip <carl.vanderlip@oss.qualcomm.com>
accel/qaic: Split oversized BO requests into multiple jobs
This commit updates the job submission logic to handle oversized buffer
objects by dividing them into multiple jobs that fit within the hardware
FIFO. It modifies job creation and scheduling to accommodate multiple
chained requests for a single slice.
> diff --git a/drivers/accel/qaic/qaic_data.c b/drivers/accel/qaic/qaic_data.c
> index 63ca4a489a9a3..7287370e4fab7 100644
> --- a/drivers/accel/qaic/qaic_data.c
> +++ b/drivers/accel/qaic/qaic_data.c
[ ... ]
> @@ -1169,11 +1166,11 @@ static inline void qaic_dbc_put_job(struct dma_bridge_chan *dbc, struct qaic_job
> static int create_slice_jobs(struct drm_file *file_priv, struct bo_slice *slice, bool partial,
> u64 resize, struct list_head *tmp_list)
> {
> + unsigned int nents_offset, nents_xfer;
> struct dbc_req *reqs = slice->reqs;
> - struct qaic_job *job = NULL;
> + struct qaic_job *job, *job_i;
> unsigned int job_count = 0;
> - unsigned int nents_xfer;
> - u64 last_bytes;
> + u64 last_bytes, seq_no;
> u32 first_n;
>
> /*
> @@ -1194,16 +1191,32 @@ static int create_slice_jobs(struct drm_file *file_priv, struct bo_slice *slice,
> else
> nents_xfer = slice->nents;
>
> - job = qaic_create_job(file_priv, slice, nents_xfer, 0, tmp_list);
> - if (IS_ERR(job))
> - return PTR_ERR(job);
> - job_count++;
> + nents_offset = 0;
> + seq_no = 0;
> + job = NULL;
> + while (nents_xfer > nents_offset) {
> + job = qaic_create_job(file_priv, slice, nents_offset, nents_xfer,
> + seq_no++, tmp_list);
[Severity: Medium]
When a BO has multiple slices, does this reset the sequence number for every
slice? This appears to create duplicate sequence numbers on the same shared BO
fence context.
Because drm_sched_job_add_dependency() deduplicates fences using
dma_fence_is_later(), the explicit intra-BO job dependencies might be silently
dropped if the new seq_no is not greater than older sequence numbers on the
same context.
> + if (IS_ERR(job))
> + goto free_jobs;
> +
> + job_count++;
> + nents_offset += job->num_req;
> + }
>
> /* job points to the last job for this slice, only valid for partial execute ioctl */
> job->partial_size = last_bytes;
> job->partial = partial;
>
> return job_count;
> +
> +free_jobs:
> + list_for_each_entry_safe_reverse(job, job_i, tmp_list, queue)
> + if (job_count--)
> + qaic_cleanup_job(job);
[Severity: High]
Does this error path leave dangling pointers in tmp_list? By calling
qaic_cleanup_job() without removing the job from tmp_list (e.g., via
list_del()), the freed jobs remain in the list.
If send_bo_list_to_sched() is the caller and this returns an error (or 0),
the error path there iterates over tmp_list again:
drivers/accel/qaic/qaic_data.c:send_bo_list_to_sched() {
...
list_for_each_entry_safe_reverse(job_i, tmp, &tmp_list, queue)
qaic_cleanup_job(job_i);
...
}
Would this result in a double free of the jobs?
[Severity: Medium]
Will this error path clobber the original error code from qaic_create_job()?
The job iterator here shadows the job variable containing the ERR_PTR, and the
function returns the post-decremented job_count (which is 0 or -1).
When this propagates up to send_bo_list_to_sched(), it sees a return of 0:
drivers/accel/qaic/qaic_data.c:send_bo_list_to_sched() {
...
ret = create_slice_jobs(file_priv, slice, false, 0, &tmp_list);
if (ret <= 0)
goto unlock_bo;
...
return ret;
}
Could this mask the failure and return 0 (success) to userspace, causing a hang
when userspace waits for BO fences that will never be signaled?
> + else
> + break;
> + return job_count;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261003023818.1161666-1-carl.vanderlip@oss.qualcomm.com?part=5
next prev parent reply other threads:[~2026-10-03 2:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-03 2:38 [PATCH 0/6] accel/qaic: Use DRM Scheduler for submitting BO reqs Carl Vanderlip
2026-10-03 2:38 ` [PATCH 1/6] accel/qaic: Centralize execution info Carl Vanderlip
2026-10-03 2:49 ` sashiko-bot
2026-10-03 2:38 ` [PATCH 2/6] accel/qaic: Replace transfer completion with dma-fence Carl Vanderlip
2026-10-03 2:54 ` sashiko-bot
2026-10-03 2:38 ` [PATCH 3/6] accel/qaic: Isolate hw submission Carl Vanderlip
2026-10-03 2:49 ` sashiko-bot
2026-10-03 2:38 ` [PATCH 4/6] accel/qaic: Use DRM_SCHED to handle FIFO submission Carl Vanderlip
2026-10-03 2:51 ` sashiko-bot
2026-10-03 2:38 ` [PATCH 5/6] accel/qaic: Split oversized BO requests into multiple jobs Carl Vanderlip
2026-10-03 2:51 ` sashiko-bot [this message]
2026-10-03 2:38 ` [PATCH 6/6] accel/qaic: Use reduced size allocation for FIFOs Carl Vanderlip
2026-10-03 2:51 ` sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261003025135.979041F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=carl.vanderlip@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.