Commit a1899777 authored by Yuri Nudelman's avatar Yuri Nudelman Committed by Oded Gabbay
Browse files

habanalabs: fix NULL dereference on cs timeout



Device descriptor is accessed before an assignment

Signed-off-by: default avatarYuri Nudelman <ynudelman@habana.ai>
Reviewed-by: default avatarOded Gabbay <ogabbay@kernel.org>
Signed-off-by: default avatarOded Gabbay <ogabbay@kernel.org>
parent 01622098
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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) {