diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2021-04-26 05:27:32 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2021-06-04 03:08:57 -0400 |
commit | cbad9503a78c23336a32172dd701b73760969ff0 (patch) | |
tree | 1e2c22db5e2c634b6259d9ab10b1309eec8d1597 /drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c | |
parent | 34993e4f7b0d47620e88ba64a6d7c67330d97e35 (diff) |
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 c78efae5e721287a3c7e9c9ca045220d6e433a30)
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>
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c index 94162b4f..f71921cb 100644 --- a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c +++ b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c | |||
@@ -488,27 +488,26 @@ static int gk20a_ctrl_alloc_as( | |||
488 | 488 | ||
489 | snprintf(name, sizeof(name), "nvhost-%s-fd%d", g->name, fd); | 489 | snprintf(name, sizeof(name), "nvhost-%s-fd%d", g->name, fd); |
490 | 490 | ||
491 | file = anon_inode_getfile(name, l->as_dev.cdev.ops, NULL, O_RDWR); | ||
492 | if (IS_ERR(file)) { | ||
493 | err = PTR_ERR(file); | ||
494 | goto clean_up; | ||
495 | } | ||
496 | |||
497 | err = gk20a_as_alloc_share(g, args->big_page_size, | 491 | err = gk20a_as_alloc_share(g, args->big_page_size, |
498 | gk20a_as_translate_as_alloc_flags(g, | 492 | gk20a_as_translate_as_alloc_flags(g, |
499 | args->flags), | 493 | args->flags), |
500 | &as_share); | 494 | &as_share); |
501 | if (err) | 495 | if (err) |
502 | goto clean_up_file; | 496 | goto clean_up; |
497 | |||
498 | file = anon_inode_getfile(name, l->as_dev.cdev.ops, as_share, O_RDWR); | ||
499 | if (IS_ERR(file)) { | ||
500 | err = PTR_ERR(file); | ||
501 | goto clean_up_as; | ||
502 | } | ||
503 | 503 | ||
504 | fd_install(fd, file); | 504 | fd_install(fd, file); |
505 | file->private_data = as_share; | ||
506 | 505 | ||
507 | args->as_fd = fd; | 506 | args->as_fd = fd; |
508 | return 0; | 507 | return 0; |
509 | 508 | ||
510 | clean_up_file: | 509 | clean_up_as: |
511 | fput(file); | 510 | gk20a_as_release_share(as_share); |
512 | clean_up: | 511 | clean_up: |
513 | put_unused_fd(fd); | 512 | put_unused_fd(fd); |
514 | return err; | 513 | return err; |