diff options
author | Dan Carpenter <error27@gmail.com> | 2011-06-25 01:54:46 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-06-26 19:20:27 -0400 |
commit | 60f7ab06651db7d9916c0d9138ed3b12676e920d (patch) | |
tree | 1f7c59c96bb11c32e5abdf46cd949593595a0bd7 | |
parent | 3b40d07d8c4a9dc33ee6e1b4ad1d377309531ffe (diff) |
drm/nouveau: error paths leak in nvc0_graph_construct_context()
Two of these error paths returned without freeing "ctx".
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nvc0_graph.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/gpu/drm/nouveau/nvc0_graph.c b/drivers/gpu/drm/nouveau/nvc0_graph.c index 39e9208a708c..3a97431996c5 100644 --- a/drivers/gpu/drm/nouveau/nvc0_graph.c +++ b/drivers/gpu/drm/nouveau/nvc0_graph.c | |||
@@ -106,7 +106,8 @@ nvc0_graph_construct_context(struct nouveau_channel *chan) | |||
106 | if (!nv_wait(dev, 0x409800, 0x80000000, 0x80000000)) { | 106 | if (!nv_wait(dev, 0x409800, 0x80000000, 0x80000000)) { |
107 | NV_ERROR(dev, "PGRAPH: HUB_SET_CHAN timeout\n"); | 107 | NV_ERROR(dev, "PGRAPH: HUB_SET_CHAN timeout\n"); |
108 | nvc0_graph_ctxctl_debug(dev); | 108 | nvc0_graph_ctxctl_debug(dev); |
109 | return -EBUSY; | 109 | ret = -EBUSY; |
110 | goto err; | ||
110 | } | 111 | } |
111 | } else { | 112 | } else { |
112 | nvc0_graph_load_context(chan); | 113 | nvc0_graph_load_context(chan); |
@@ -119,10 +120,8 @@ nvc0_graph_construct_context(struct nouveau_channel *chan) | |||
119 | } | 120 | } |
120 | 121 | ||
121 | ret = nvc0_grctx_generate(chan); | 122 | ret = nvc0_grctx_generate(chan); |
122 | if (ret) { | 123 | if (ret) |
123 | kfree(ctx); | 124 | goto err; |
124 | return ret; | ||
125 | } | ||
126 | 125 | ||
127 | if (!nouveau_ctxfw) { | 126 | if (!nouveau_ctxfw) { |
128 | nv_wr32(dev, 0x409840, 0x80000000); | 127 | nv_wr32(dev, 0x409840, 0x80000000); |
@@ -131,14 +130,13 @@ nvc0_graph_construct_context(struct nouveau_channel *chan) | |||
131 | if (!nv_wait(dev, 0x409800, 0x80000000, 0x80000000)) { | 130 | if (!nv_wait(dev, 0x409800, 0x80000000, 0x80000000)) { |
132 | NV_ERROR(dev, "PGRAPH: HUB_CTX_SAVE timeout\n"); | 131 | NV_ERROR(dev, "PGRAPH: HUB_CTX_SAVE timeout\n"); |
133 | nvc0_graph_ctxctl_debug(dev); | 132 | nvc0_graph_ctxctl_debug(dev); |
134 | return -EBUSY; | 133 | ret = -EBUSY; |
134 | goto err; | ||
135 | } | 135 | } |
136 | } else { | 136 | } else { |
137 | ret = nvc0_graph_unload_context_to(dev, chan->ramin->vinst); | 137 | ret = nvc0_graph_unload_context_to(dev, chan->ramin->vinst); |
138 | if (ret) { | 138 | if (ret) |
139 | kfree(ctx); | 139 | goto err; |
140 | return ret; | ||
141 | } | ||
142 | } | 140 | } |
143 | 141 | ||
144 | for (i = 0; i < priv->grctx_size; i += 4) | 142 | for (i = 0; i < priv->grctx_size; i += 4) |
@@ -146,6 +144,10 @@ nvc0_graph_construct_context(struct nouveau_channel *chan) | |||
146 | 144 | ||
147 | priv->grctx_vals = ctx; | 145 | priv->grctx_vals = ctx; |
148 | return 0; | 146 | return 0; |
147 | |||
148 | err: | ||
149 | kfree(ctx); | ||
150 | return ret; | ||
149 | } | 151 | } |
150 | 152 | ||
151 | static int | 153 | static int |