accel/habanalabs: fix bug in timestamp interrupt handling
authorfarah kassabri <fkassabri@habana.ai>
Thu, 24 Aug 2023 12:45:21 +0000 (15:45 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Mon, 9 Oct 2023 09:37:22 +0000 (12:37 +0300)
commit0165994c215f321e2d055368f89b424756e340eb
tree920bff6b1bf4a41a98244d73211c5335ed302186
parentd89d329a2bb39e0e0ad37d7a40302d0fa7e8851a
accel/habanalabs: fix bug in timestamp interrupt handling

There is a potential race between user thread seeking to re-use
a timestamp record with new interrupt id, while this record is still
in the middle of interrupt handling and it is about to be freed.
Imagine the driver set the record in_use to 0 and only then fill the
free_node information. This might lead to unpleasant scenario where
the new registration thread detects the record as free to use, and
change the cq buff address. That will cause the free_node to get
the wrong buffer address to put refcount to.

Signed-off-by: farah kassabri <fkassabri@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/accel/habanalabs/common/irq.c