Skip to content

Commit

Permalink
drm/nouveau: error paths leak in nvc0_graph_construct_context()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Ben Skeggs committed Jun 26, 2011
1 parent 3b40d07 commit 60f7ab0
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions drivers/gpu/drm/nouveau/nvc0_graph.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ nvc0_graph_construct_context(struct nouveau_channel *chan)
if (!nv_wait(dev, 0x409800, 0x80000000, 0x80000000)) {
NV_ERROR(dev, "PGRAPH: HUB_SET_CHAN timeout\n");
nvc0_graph_ctxctl_debug(dev);
return -EBUSY;
ret = -EBUSY;
goto err;
}
} else {
nvc0_graph_load_context(chan);
Expand All @@ -119,10 +120,8 @@ nvc0_graph_construct_context(struct nouveau_channel *chan)
}

ret = nvc0_grctx_generate(chan);
if (ret) {
kfree(ctx);
return ret;
}
if (ret)
goto err;

if (!nouveau_ctxfw) {
nv_wr32(dev, 0x409840, 0x80000000);
Expand All @@ -131,21 +130,24 @@ nvc0_graph_construct_context(struct nouveau_channel *chan)
if (!nv_wait(dev, 0x409800, 0x80000000, 0x80000000)) {
NV_ERROR(dev, "PGRAPH: HUB_CTX_SAVE timeout\n");
nvc0_graph_ctxctl_debug(dev);
return -EBUSY;
ret = -EBUSY;
goto err;
}
} else {
ret = nvc0_graph_unload_context_to(dev, chan->ramin->vinst);
if (ret) {
kfree(ctx);
return ret;
}
if (ret)
goto err;
}

for (i = 0; i < priv->grctx_size; i += 4)
ctx[i / 4] = nv_ro32(grch->grctx, i);

priv->grctx_vals = ctx;
return 0;

err:
kfree(ctx);
return ret;
}

static int
Expand Down

0 comments on commit 60f7ab0

Please sign in to comment.