[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20210927121055.97751-2-ogabbay@kernel.org>
Date: Mon, 27 Sep 2021 15:10:55 +0300
From: Oded Gabbay <ogabbay@...nel.org>
To: linux-kernel@...r.kernel.org
Cc: Rajaravi Krishna Katta <rkatta@...ana.ai>
Subject: [PATCH 2/2] habanalabs: fix resetting args in wait for CS
From: Rajaravi Krishna Katta <rkatta@...ana.ai>
If _hl_cs_wait_ioctl returns -ERESTARTSYS, resetting args would clear
user flags and will result in error in case the userspace repeats the
ioctl call.
Signed-off-by: Rajaravi Krishna Katta <rkatta@...ana.ai>
Reviewed-by: Oded Gabbay <ogabbay@...nel.org>
Signed-off-by: Oded Gabbay <ogabbay@...nel.org>
---
.../misc/habanalabs/common/command_submission.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/misc/habanalabs/common/command_submission.c b/drivers/misc/habanalabs/common/command_submission.c
index 39fc6d4fb971..b479d9ebeb94 100644
--- a/drivers/misc/habanalabs/common/command_submission.c
+++ b/drivers/misc/habanalabs/common/command_submission.c
@@ -2688,16 +2688,17 @@ static int hl_cs_wait_ioctl(struct hl_fpriv *hpriv, void *data)
rc = _hl_cs_wait_ioctl(hdev, hpriv->ctx, args->in.timeout_us, seq,
&status, ×tamp);
+ if (rc == -ERESTARTSYS) {
+ dev_err_ratelimited(hdev->dev,
+ "user process got signal while waiting for CS handle %llu\n",
+ seq);
+ return -EINTR;
+ }
+
memset(args, 0, sizeof(*args));
if (rc) {
- if (rc == -ERESTARTSYS) {
- dev_err_ratelimited(hdev->dev,
- "user process got signal while waiting for CS handle %llu\n",
- seq);
- args->out.status = HL_WAIT_CS_STATUS_INTERRUPTED;
- rc = -EINTR;
- } else if (rc == -ETIMEDOUT) {
+ if (rc == -ETIMEDOUT) {
dev_err_ratelimited(hdev->dev,
"CS %llu has timed-out while user process is waiting for it\n",
seq);
--
2.17.1
Powered by blists - more mailing lists