habanalabs: fix NULL pointer dereference
authorDani Liberman <dliberman@habana.ai>
Wed, 6 Oct 2021 06:36:19 +0000 (09:36 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Mon, 18 Oct 2021 09:05:47 +0000 (12:05 +0300)
commit81f8582ec404b2ab3ec1d412e33703e014fc3121
tree999b2399aec7284f4450e0f6a19915204e21b6bf
parentea6eb91c09cd4f2f92ba28ba277d2ecf63cdc237
habanalabs: fix NULL pointer dereference

When polling fences for multi CS, it is possible that fence is
no longer exists (its corresponding CS completed and the fence was
deleted) but we still accessing its parameters, causing NULL pointer
dereference.

Fixed by checking if fence exits before accessing its parameters.

Signed-off-by: Dani Liberman <dliberman@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/command_submission.c