From nobody Sun Sep 27 00:44:16 2026 Received: from mail-m155101.qiye.163.com (mail-m155101.qiye.163.com [101.71.155.101]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8D071E9B3D; Thu, 27 Aug 2026 17:06:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=101.71.155.101 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787850384; cv=none; b=QQ6L+3WJxu1p7Na6hzvRi0XsSBm4WxZpAlEbVVVBb/FAMJwmtSTd5fTYlgG+3910J2GzefwfXDlI74IXrI56yVkDTCeHSs5tfh86yhf+U3QYqMx/Z/AavsqiMDZLg5H99VLsXdk8rtJUfe44p/x4rHgNz3L1EzCGmVNrxp5lqko= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787850384; c=relaxed/simple; bh=p6sto07lzQQq/WJCX4rsuB9Yq6Scdhq71+xKiMyl5Rc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qs4Jsn7dJjVw1qi/Fo6LXvqFhc5Mxvd5Yxp/QsbcfU0EAJp0j7CEviHORWEZ8wfMERG0RN6bFzkyjzeEVlTVEe9I5ZhPkNvEZlVPP6UXBd2CEm5KqIqKxql7AkCUkWit6w433HLInnadbFcU09FQtppIosZEAzVedompxtrTxIg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=whut.edu.cn; spf=pass smtp.mailfrom=whut.edu.cn; arc=none smtp.client-ip=101.71.155.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=whut.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=whut.edu.cn Received: from Mogu.localdomain (unknown [223.73.65.69]) by smtp.qiye.163.com (Hmail) with ESMTP id 4b9692dcf; Fri, 28 Aug 2026 01:06:17 +0800 (GMT+08:00) From: MoGGuU To: Tomeu Vizoso Cc: Oded Gabbay , Jeff Hugo , Sidong Yang , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v2 1/3] accel/rocket: Validate BO handle counts on job submission Date: Fri, 28 Aug 2026 01:06:06 +0800 Message-ID: <20260827170608.39511-2-Naixumogu@whut.edu.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260827170608.39511-1-Naixumogu@whut.edu.cn> References: <20260827170608.39511-1-Naixumogu@whut.edu.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-HM-Tid: 0aa0442fc77503a1kunmddadd30e6f5a7 X-HM-MType: 10 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVkaGk5KVkgeSBhOQk5JGkxLHVYeHw 5VEwETFhoSFyQUDg9ZV1kYEgtZQVlJSUhVTEhVTU5VTUJZV1kWGg8SFR0UWUFZS1VLVUtVS1kG Content-Type: text/plain; charset="utf-8" The input and output BO handle counts are __u32, while GEM lookup and reservation helpers take int counts. A count above INT_MAX, or a combined count above INT_MAX, cannot be represented safely at those call sites. Reject such counts before looking up the BOs. Fixes: 0810d5ad88a1 ("accel/rocket: Add job submission IOCTL") Cc: stable@vger.kernel.org Tested-by: Sidong Yang Signed-off-by: MoGGuU --- drivers/accel/rocket/rocket_job.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/accel/rocket/rocket_job.c b/drivers/accel/rocket/rocke= t_job.c index bb77b6bf0f231..7e3d123afc5ad 100644 --- a/drivers/accel/rocket/rocket_job.c +++ b/drivers/accel/rocket/rocket_job.c @@ -556,6 +556,12 @@ static int rocket_ioctl_submit_job(struct drm_device *= dev, struct drm_file *file if (job->task_count =3D=3D 0) return -EINVAL; =20 + /* GEM lookup and reservation helpers take signed object counts. */ + if (job->in_bo_handle_count > INT_MAX || + job->out_bo_handle_count > INT_MAX || + job->in_bo_handle_count > INT_MAX - job->out_bo_handle_count) + return -EINVAL; + rjob =3D kzalloc_obj(*rjob); if (!rjob) return -ENOMEM; --=20 2.43.0 From nobody Sun Sep 27 00:44:16 2026 Received: from mail-m49198.qiye.163.com (mail-m49198.qiye.163.com [45.254.49.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BDCD6385D6B; Thu, 27 Aug 2026 17:06:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.254.49.198 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787850384; cv=none; b=EKovnTLHTgkZlG9WZ4ublPzE3+Uh8MQAx9yXjrEHPwtv0qN4EpDRAfdrjMyKZlizzKJcYAAOw1KxnwRfbfUBxYiXyxl5tuhWI6kOi4ET/jxIX3RHN3kynGS/WXs+xaO/GY5SQSjPute2G3E11sRTj4AQIrWZaQ360uwDAjqipAE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787850384; c=relaxed/simple; bh=grhNMjXscsuBDTkvaUO64cIyMjU5vdstBwr3L94tIsI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gvw7ipb6Tf+KN+XMnxAkSHSfHVBIFqdPVz/9DHSuU0e79ibdJEYnRmEQKS0oun1NcSIOPSgbqxRRxpN4ZmhI0Fh7R5Nse4YgFSC2kZe6fXbOvNXVCSkX1AbfkRmS0nh05xTConTPjU1uvVdtyeSSFpLcJR3Qis5d21TMXbgW1W8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=whut.edu.cn; spf=pass smtp.mailfrom=whut.edu.cn; arc=none smtp.client-ip=45.254.49.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=whut.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=whut.edu.cn Received: from Mogu.localdomain (unknown [223.73.65.69]) by smtp.qiye.163.com (Hmail) with ESMTP id 4b9692dd0; Fri, 28 Aug 2026 01:06:17 +0800 (GMT+08:00) From: MoGGuU To: Tomeu Vizoso Cc: Oded Gabbay , Jeff Hugo , Sidong Yang , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v2 2/3] accel/rocket: Collect job dependencies before arming Date: Fri, 28 Aug 2026 01:06:07 +0800 Message-ID: <20260827170608.39511-3-Naixumogu@whut.edu.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260827170608.39511-1-Naixumogu@whut.edu.cn> References: <20260827170608.39511-1-Naixumogu@whut.edu.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-HM-Tid: 0aa0442fca0203a1kunmddadd30e6f5a8 X-HM-MType: 10 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVlDQ0IaVh1KTRhDTkgfQhlIQ1YeHw 5VEwETFhoSFyQUDg9ZV1kYEgtZQVlJSUhVTEhVTU5VTUJZV1kWGg8SFR0UWUFZS1VLVUtVS1kG Content-Type: text/plain; charset="utf-8" rocket_job_push() arms the scheduler job before collecting its implicit dependencies. Dependency collection can fail with -ENOMEM, but an armed job must be pushed and must not be aborted with drm_sched_job_cleanup(). Collect dependencies before taking the scheduler lock and arming the job. Only operations that cannot fail remain after drm_sched_job_arm(). Fixes: 0810d5ad88a1 ("accel/rocket: Add job submission IOCTL") Cc: stable@vger.kernel.org Tested-by: Sidong Yang Signed-off-by: MoGGuU --- drivers/accel/rocket/rocket_job.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/accel/rocket/rocket_job.c b/drivers/accel/rocket/rocke= t_job.c index 7e3d123afc5ad..51e8b43c05131 100644 --- a/drivers/accel/rocket/rocket_job.c +++ b/drivers/accel/rocket/rocket_job.c @@ -206,19 +206,21 @@ static int rocket_job_push(struct rocket_job *job) if (ret) goto err; =20 + ret =3D rocket_acquire_object_fences(job->in_bos, job->in_bo_count, + &job->base, false); + if (ret) + goto err_unlock; + + ret =3D rocket_acquire_object_fences(job->out_bos, job->out_bo_count, + &job->base, true); + if (ret) + goto err_unlock; + scoped_guard(mutex, &rdev->sched_lock) { drm_sched_job_arm(&job->base); =20 job->inference_done_fence =3D dma_fence_get(&job->base.s_fence->finished= ); =20 - ret =3D rocket_acquire_object_fences(job->in_bos, job->in_bo_count, &job= ->base, false); - if (ret) - goto err_unlock; - - ret =3D rocket_acquire_object_fences(job->out_bos, job->out_bo_count, &j= ob->base, true); - if (ret) - goto err_unlock; - kref_get(&job->refcount); /* put by scheduler job completion */ =20 drm_sched_entity_push_job(&job->base); --=20 2.43.0 From nobody Sun Sep 27 00:44:16 2026 Received: from mail-m49197.qiye.163.com (mail-m49197.qiye.163.com [45.254.49.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9177E2D5926; Thu, 27 Aug 2026 17:06:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.254.49.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787850392; cv=none; b=nhNYD4OZ65F867IyNMYc4vlEfFOAf6KawyH/UBiPo0Q3jUOr4r6oRyLQs/3fog+Cai1kUUTo6RFDYb097SckZpBVbNR0SgdVnI9NP3GsElJz6ETvZ5fGxlUpcQRS26wyYPpdfBb/zbqOQjZrmz/rF0QncA61e7+Q3XkmeHGspIA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787850392; c=relaxed/simple; bh=kyXZEe0Kzoi99sZpUd7tz39V5ngLlG/i9JC/fbnASeI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bX8CGYG6Y0hALk6S8ISc6Sv/aSK1CYGvBOKJ7SZCar9+N6y3dA0Bna6IKL1qa+XH1Ym0YeLWpUCxeRaQ0eWHGu8o7mIWZp71W444o5Tn6RwNQH8QRRQQWkFGk+QfBrRzURN4DBlcm5QEZ1v/0lRO8KORl8ujxqjRobvH9DaoeRE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=whut.edu.cn; spf=pass smtp.mailfrom=whut.edu.cn; arc=none smtp.client-ip=45.254.49.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=whut.edu.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=whut.edu.cn Received: from Mogu.localdomain (unknown [223.73.65.69]) by smtp.qiye.163.com (Hmail) with ESMTP id 4b9692dd1; Fri, 28 Aug 2026 01:06:18 +0800 (GMT+08:00) From: MoGGuU To: Tomeu Vizoso Cc: Oded Gabbay , Jeff Hugo , Sidong Yang , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH v2 3/3] accel/rocket: Propagate job submission errors Date: Fri, 28 Aug 2026 01:06:08 +0800 Message-ID: <20260827170608.39511-4-Naixumogu@whut.edu.cn> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260827170608.39511-1-Naixumogu@whut.edu.cn> References: <20260827170608.39511-1-Naixumogu@whut.edu.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-HM-Tid: 0aa0442fcc4d03a1kunmddadd30e6f5a9 X-HM-MType: 10 X-HM-Spam-Status: e1kfGhgUHx5ZQUtXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVkZH0pMVk9PTk5LTEIYQkpPTFYeHw 5VEwETFhoSFyQUDg9ZV1kYEgtZQVlJSUhVTEhVTU5VTUJZV1kWGg8SFR0UWUFZS1VLVUtVS1kG Content-Type: text/plain; charset="utf-8" rocket_ioctl_submit() discards each job's return value and reports success even when every job fails. Return the first error and stop submitting the remaining jobs. Jobs queued before an error remain queued, giving the ioctl ordered partial-submit semantics. Fixes: 0810d5ad88a1 ("accel/rocket: Add job submission IOCTL") Cc: stable@vger.kernel.org Tested-by: Sidong Yang Signed-off-by: MoGGuU --- 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/rocke= t_job.c index 51e8b43c05131..964d12475a0d5 100644 --- a/drivers/accel/rocket/rocket_job.c +++ b/drivers/accel/rocket/rocket_job.c @@ -647,8 +647,11 @@ int rocket_ioctl_submit(struct drm_device *dev, void *= data, struct drm_file *fil } =20 =20 - for (i =3D 0; i < args->job_count; i++) - rocket_ioctl_submit_job(dev, file, &jobs[i]); + for (i =3D 0; i < args->job_count; i++) { + ret =3D rocket_ioctl_submit_job(dev, file, &jobs[i]); + if (ret) + goto exit; + } =20 exit: kvfree(jobs); --=20 2.43.0