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
Bug 200725718

Change-Id: I03e79a3f8981f959ab5f75f442911253d166aa87
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2520465
(cherry picked from commit c78efae5e7)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2535099
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: Harsh Sinha <hsinha@nvidia.com>
Reviewed-by: Thomas Steinle <tsteinle@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: Byungkuk Seo <bseo@nvidia.com>
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 34993e4f7b
commit cbad9503a7
2 changed files with 17 additions and 21 deletions

View File

@@ -488,27 +488,26 @@ static int gk20a_ctrl_alloc_as(
snprintf(name, sizeof(name), "nvhost-%s-fd%d", g->name, fd);
file = anon_inode_getfile(name, l->as_dev.cdev.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),
&as_share);
if (err)
goto clean_up_file;
goto clean_up;
file = anon_inode_getfile(name, l->as_dev.cdev.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;