diff options
author | John Stultz <john.stultz@linaro.org> | 2021-10-13 10:22:40 -0700 |
---|---|---|
committer | Will McVicker <willmcvicker@google.com> | 2021-10-13 10:24:53 -0700 |
commit | ac745929d04f4ed9667871be470758b92931faf3 (patch) | |
tree | 7ed93445928f0cf346ea78f2fde28609026ce4ba /mali_kbase/mali_kbase_sync_file.c | |
parent | 91f48c763489fd6775dc358547c8d6f02efc02fe (diff) | |
download | gpu-ac745929d04f4ed9667871be470758b92931faf3.tar.gz |
MALI: Drop use of ksys_close(), rework fd_install usage
GregKH objected to the __close_fd() symbol being used
by the mali driver, via ksys_close(), suggesting I reach
out the the mali team as it was supposedly fixed.
In talking with the mali folks, it is not yet fixed.
The only usage is in an error path in the case that the
copy_to_user fails, where we have an fd that was created
but not passed out to userland.
Greg suggested fput/put_unused_fd() to be used instead
which requires refactoring the logic a bit (as the
kbase_sync_fence_out_create() call would return an
installed fd), so that we can only install the fd
if the copy_to_user succeeds, which matches the pattern
used elsewhere in the kernel.
Careful review would be appreciated!
Bug: 200010226
Test: boot tested on raven
Signed-off-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Will McVicker <willmcvicker@google.com>
Change-Id: Ia03191a32f8770cf3e9d9b30a13b18e13edb7419
Diffstat (limited to 'mali_kbase/mali_kbase_sync_file.c')
-rw-r--r-- | mali_kbase/mali_kbase_sync_file.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/mali_kbase/mali_kbase_sync_file.c b/mali_kbase/mali_kbase_sync_file.c index 61482ad..b015198 100644 --- a/mali_kbase/mali_kbase_sync_file.c +++ b/mali_kbase/mali_kbase_sync_file.c @@ -59,7 +59,7 @@ int kbase_sync_fence_stream_create(const char *name, int *const out_fd) } #if !MALI_USE_CSF -int kbase_sync_fence_out_create(struct kbase_jd_atom *katom, int stream_fd) +struct sync_file *kbase_sync_fence_out_create(struct kbase_jd_atom *katom, int stream_fd) { #if (KERNEL_VERSION(4, 10, 0) > LINUX_VERSION_CODE) struct fence *fence; @@ -67,11 +67,10 @@ int kbase_sync_fence_out_create(struct kbase_jd_atom *katom, int stream_fd) struct dma_fence *fence; #endif struct sync_file *sync_file; - int fd; fence = kbase_fence_out_new(katom); if (!fence) - return -ENOMEM; + return NULL; #if (KERNEL_VERSION(4, 9, 67) >= LINUX_VERSION_CODE) /* Take an extra reference to the fence on behalf of the sync_file. @@ -89,19 +88,9 @@ int kbase_sync_fence_out_create(struct kbase_jd_atom *katom, int stream_fd) dma_fence_put(fence); #endif kbase_fence_out_remove(katom); - return -ENOMEM; + return NULL; } - - fd = get_unused_fd_flags(O_CLOEXEC); - if (fd < 0) { - fput(sync_file->file); - kbase_fence_out_remove(katom); - return fd; - } - - fd_install(fd, sync_file->file); - - return fd; + return sync_file; } int kbase_sync_fence_in_from_fd(struct kbase_jd_atom *katom, int fd) |