mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] accel/rocket: fix ignored return value in rocket_ioctl_submit
@ 2026-05-10 20:00 Kartik Nair
  2026-11-17 14:27 ` Daniel Drake
  0 siblings, 1 reply; 2+ messages in thread
From: Kartik Nair @ 2026-05-10 20:00 UTC (permalink / raw)
  To: tomeu, ogabbay; +Cc: dri-devel, linux-kernel, Kartik Nair

rocket_ioctl_submit() calls rocket_ioctl_submit_job() in a loop but
ignores its return value. If any job submission fails, the error is
silently dropped and the function returns 0 (success) to userspace,
leaving subsequent jobs potentially in an inconsistent state.

Fix this by propagating the error and breaking out of the loop on
the first failure.

Signed-off-by: Kartik Nair <contact.kartikn@gmail.com>
---
 drivers/accel/rocket/rocket_job.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/accel/rocket/rocket_job.c b/drivers/accel/rocket/rocket_job.c
index ac51bff39..abac26853 100644
--- a/drivers/accel/rocket/rocket_job.c
+++ b/drivers/accel/rocket/rocket_job.c
@@ -626,8 +626,11 @@ int rocket_ioctl_submit(struct drm_device *dev, void *data, struct drm_file *fil
 	}
 
 
-	for (i = 0; i < args->job_count; i++)
-		rocket_ioctl_submit_job(dev, file, &jobs[i]);
+	for (i = 0; i < args->job_count; i++) {
+		ret = rocket_ioctl_submit_job(dev, file, &jobs[i]);
+		if (ret)
+			goto exit;
+	}
 
 exit:
 	kvfree(jobs);
-- 
2.50.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] accel/rocket: fix ignored return value in rocket_ioctl_submit
  2026-05-10 20:00 [PATCH] accel/rocket: fix ignored return value in rocket_ioctl_submit Kartik Nair
@ 2026-11-17 14:27 ` Daniel Drake
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Drake @ 2026-11-17 14:27 UTC (permalink / raw)
  To: Kartik Nair, tomeu, ogabbay; +Cc: dri-devel, linux-kernel

Hi,

On 10/05/2026 21:00, Kartik Nair wrote:
> rocket_ioctl_submit() calls rocket_ioctl_submit_job() in a loop but
> ignores its return value. If any job submission fails, the error is
> silently dropped and the function returns 0 (success) to userspace,
> leaving subsequent jobs potentially in an inconsistent state.
> 
> Fix this by propagating the error and breaking out of the loop on
> the first failure.

There's definitely a bug in there, but this approach is just replacing 
one incorrect behaviour with another.

After your change if there is an -EINTR generated from within the job 
submission, this will cause drmIoctl to retry the exact same job 
sequence, likely causing parts of the sequence to be repeated, possibly 
with negative consequences.

And on other error paths that would be bubbled up by your change, 
userspace won't be able to know which parts of the sequence ran vs failed.

I think we need a deeper change here. Is it possible to fully prepare 
and arm the whole job list first, without executing yet, returning an 
error code if anything goes wrong in the process?

Then the execution of the job list could happen as a second stage, 
hopefully without any possibility of failure.

Daniel


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-17 14:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-10 20:00 [PATCH] accel/rocket: fix ignored return value in rocket_ioctl_submit Kartik Nair
2026-11-17 14:27 ` Daniel Drake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®