gpu: nvgpu: set file private data before installing fd

Make sure file->private_data is set before installing file into file
descriptor with fd_install().

Bug 200724607

Change-Id: I03e79a3f8981f959ab5f75f442911253d166aa87
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2520465
Reviewed-by: Konsta Holtta <kholtta@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2021-04-26 14:57:32 +05:30
committed by mobile promotions
parent ab6d4fa543
commit c78efae5e7
2 changed files with 19 additions and 21 deletions

View File

@@ -621,12 +621,6 @@ static int gk20a_ctrl_alloc_as(
(void) snprintf(name, sizeof(name), "nvhost-%s-fd%d", g->name, fd);
file = anon_inode_getfile(name, &gk20a_as_ops, NULL, O_RDWR);
if (IS_ERR(file)) {
err = PTR_ERR(file);
goto clean_up;
}
err = gk20a_as_alloc_share(g, args->big_page_size,
gk20a_as_translate_as_alloc_flags(g,
args->flags),
@@ -635,16 +629,21 @@ static int gk20a_ctrl_alloc_as(
args->va_range_split,
&as_share);
if (err)
goto clean_up_file;
goto clean_up;
file = anon_inode_getfile(name, &gk20a_as_ops, as_share, O_RDWR);
if (IS_ERR(file)) {
err = PTR_ERR(file);
goto clean_up_as;
}
fd_install(fd, file);
file->private_data = as_share;
args->as_fd = fd;
return 0;
clean_up_file:
fput(file);
clean_up_as:
gk20a_as_release_share(as_share);
clean_up:
put_unused_fd(fd);
return err;