diff options
author | Yuri Nudelman <ynudelman@habana.ai> | 2022-06-14 15:14:20 +0300 |
---|---|---|
committer | Oded Gabbay <ogabbay@kernel.org> | 2022-07-12 09:09:23 +0300 |
commit | a18997770159b9b48a5c20630223e4f9d3e2bdb5 (patch) | |
tree | 5e58d4bb6c3f400dc1c774d594dc99f8ddaae948 /drivers/misc | |
parent | 01622098aeb05a5efbb727199bbc2a4653393255 (diff) | |
download | linux-a18997770159b9b48a5c20630223e4f9d3e2bdb5.tar.bz2 |
habanalabs: fix NULL dereference on cs timeout
Device descriptor is accessed before an assignment
Signed-off-by: Yuri Nudelman <ynudelman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r-- | drivers/misc/habanalabs/common/command_submission.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/misc/habanalabs/common/command_submission.c b/drivers/misc/habanalabs/common/command_submission.c index 72a557b83a7d..c050f38b7091 100644 --- a/drivers/misc/habanalabs/common/command_submission.c +++ b/drivers/misc/habanalabs/common/command_submission.c @@ -812,6 +812,8 @@ static void cs_timedout(struct work_struct *work) return; } + hdev = cs->ctx->hdev; + if (likely(!skip_reset_on_timeout)) { if (hdev->reset_on_lockup) device_reset = true; @@ -822,8 +824,6 @@ static void cs_timedout(struct work_struct *work) cs->timedout = true; } - hdev = cs->ctx->hdev; - /* Save only the first CS timeout parameters */ rc = atomic_cmpxchg(&hdev->last_error.cs_timeout.write_enable, 1, 0); if (rc) { |