diff options
author | Francisco Jerez <currojerez@riseup.net> | 2010-10-17 21:56:14 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-12-03 00:06:43 -0500 |
commit | 2a6789ae5e8a6b25a0835834655205166a757a81 (patch) | |
tree | b519dacc6f1e5d0f85e2e57fd1fdecdbc60cbfee /drivers/gpu/drm/nouveau/nouveau_fence.c | |
parent | f091a3d403065416b7d27221bbeb956481132ffd (diff) |
drm/nouveau: Make fences take a weak channel reference.
Fences didn't increment the channel reference count, and the fenced
channel could go away at any time. Fixes a potential race in
nouveau_fence_update().
Signed-off-by: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_fence.c')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_fence.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_fence.c b/drivers/gpu/drm/nouveau/nouveau_fence.c index 0a22955998e8..e1ae9bab6e41 100644 --- a/drivers/gpu/drm/nouveau/nouveau_fence.c +++ b/drivers/gpu/drm/nouveau/nouveau_fence.c | |||
@@ -64,6 +64,7 @@ nouveau_fence_del(struct kref *ref) | |||
64 | struct nouveau_fence *fence = | 64 | struct nouveau_fence *fence = |
65 | container_of(ref, struct nouveau_fence, refcount); | 65 | container_of(ref, struct nouveau_fence, refcount); |
66 | 66 | ||
67 | nouveau_channel_ref(NULL, &fence->channel); | ||
67 | kfree(fence); | 68 | kfree(fence); |
68 | } | 69 | } |
69 | 70 | ||
@@ -113,7 +114,7 @@ nouveau_fence_new(struct nouveau_channel *chan, struct nouveau_fence **pfence, | |||
113 | if (!fence) | 114 | if (!fence) |
114 | return -ENOMEM; | 115 | return -ENOMEM; |
115 | kref_init(&fence->refcount); | 116 | kref_init(&fence->refcount); |
116 | fence->channel = chan; | 117 | nouveau_channel_ref(chan, &fence->channel); |
117 | 118 | ||
118 | if (emit) | 119 | if (emit) |
119 | ret = nouveau_fence_emit(fence); | 120 | ret = nouveau_fence_emit(fence); |