diff options
author | David Nieto <dmartineznie@nvidia.com> | 2017-02-13 14:22:59 -0500 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-03-20 19:39:55 -0400 |
commit | 74fe1caa2b56aab24c17ad4dd2524128fc237894 (patch) | |
tree | 0793bb92b67d64690658f3f7cd1a8e1ea93206ba /drivers/gpu/nvgpu/gk20a/as_gk20a.c | |
parent | 469308becaff326da02fcf791e803e812e1cf9f8 (diff) |
gpu: nvgpu: Add refcounting to driver fds
The main driver structure is not refcounted properly,
so when the driver unload, file desciptors associated to the
driver are kept open with dangling references to the main object.
This change adds referencing to the gk20a structure.
bug 200277762
JIRA: EVLR-1023
Change-Id: Id892e9e1677a344789e99bf649088c076f0bf8de
Signed-off-by: David Nieto <dmartineznie@nvidia.com>
Reviewed-on: http://git-master/r/1317420
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/as_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/as_gk20a.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/as_gk20a.c b/drivers/gpu/nvgpu/gk20a/as_gk20a.c index e4bd8b73..a3c8c1ec 100644 --- a/drivers/gpu/nvgpu/gk20a/as_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/as_gk20a.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GK20A Address Spaces | 2 | * GK20A Address Spaces |
3 | * | 3 | * |
4 | * Copyright (c) 2011-2015, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -46,6 +46,9 @@ int gk20a_as_alloc_share(struct gk20a_as *as, | |||
46 | int err = 0; | 46 | int err = 0; |
47 | 47 | ||
48 | gk20a_dbg_fn(""); | 48 | gk20a_dbg_fn(""); |
49 | g = gk20a_get(g); | ||
50 | if (!g) | ||
51 | return -ENODEV; | ||
49 | 52 | ||
50 | *out = NULL; | 53 | *out = NULL; |
51 | as_share = kzalloc(sizeof(*as_share), GFP_KERNEL); | 54 | as_share = kzalloc(sizeof(*as_share), GFP_KERNEL); |
@@ -85,15 +88,19 @@ int gk20a_as_release_share(struct gk20a_as_share *as_share) | |||
85 | gk20a_dbg_fn(""); | 88 | gk20a_dbg_fn(""); |
86 | 89 | ||
87 | err = gk20a_busy(g->dev); | 90 | err = gk20a_busy(g->dev); |
91 | |||
88 | if (err) | 92 | if (err) |
89 | return err; | 93 | goto release_fail; |
90 | 94 | ||
91 | err = gk20a_vm_release_share(as_share); | 95 | err = gk20a_vm_release_share(as_share); |
92 | 96 | ||
93 | gk20a_idle(g->dev); | 97 | gk20a_idle(g->dev); |
94 | 98 | ||
99 | release_fail: | ||
95 | release_as_share_id(as_share->as, as_share->id); | 100 | release_as_share_id(as_share->as, as_share->id); |
101 | gk20a_put(g); | ||
96 | kfree(as_share); | 102 | kfree(as_share); |
103 | |||
97 | return err; | 104 | return err; |
98 | } | 105 | } |
99 | 106 | ||