]> git.baikalelectronics.ru Git - kernel.git/commit
habanalabs: fix resetting args in wait for CS IOCTL
authorRajaravi Krishna Katta <rkatta@habana.ai>
Tue, 14 Sep 2021 15:28:48 +0000 (18:28 +0300)
committerOded Gabbay <ogabbay@kernel.org>
Wed, 29 Sep 2021 09:18:48 +0000 (12:18 +0300)
commitbc5310b2967ff7365799919499b4d00d363eefa1
tree077bdfbe423b148f1bda55dd978c708b52d1f797
parent75973fee24ad8c6e7b72bc09c1748af82d73361d
habanalabs: fix resetting args in wait for CS IOCTL

In wait for CS IOCTL code, the driver resets the incoming args structure
before returning to the user, regardless of the return value of the
IOCTL.

In case the IOCTL returns EINTR, resetting the args will result in error
in case the userspace will repeat the ioctl call immediately (which is
the behavior in the hl-thunk userspace library).

The solution is to reset the args only if the driver returns success (0)
as a return value for the IOCTL.

Signed-off-by: Rajaravi Krishna Katta <rkatta@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
drivers/misc/habanalabs/common/command_submission.c
include/uapi/misc/habanalabs.h