diff options
author | Jerome Glisse <jglisse@redhat.com> | 2010-02-11 06:44:32 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-02-11 15:48:33 -0500 |
commit | 7cb72ef4d39978e6e07415a2d552b06d567c3079 (patch) | |
tree | 122dd81c7be26b25f85cfb6261626d6589d503cb /drivers/gpu | |
parent | 82568565683b4991964a5fc89a9ca0c7122818e8 (diff) |
drm/radeon/kms: fix r600/r700 cs checker to avoid double kfree
radeon_cs kfree the tracker structure but for r6xx/r7xx we want
to kfree it inside the parse function because we share it with
the UMS code path. Set tracker to NULL after freeing it will
avoid double free.
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/r600_cs.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index ac67d6488a95..00e69c585fbf 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
@@ -846,9 +846,9 @@ static inline int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx | |||
846 | "0x%04X\n", reg); | 846 | "0x%04X\n", reg); |
847 | return -EINVAL; | 847 | return -EINVAL; |
848 | } | 848 | } |
849 | tmp = (reg - CB_COLOR0_BASE) / 4; | ||
849 | track->cb_color_bo_offset[tmp] = radeon_get_ib_value(p, idx); | 850 | track->cb_color_bo_offset[tmp] = radeon_get_ib_value(p, idx); |
850 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); | 851 | ib[idx] += (u32)((reloc->lobj.gpu_offset >> 8) & 0xffffffff); |
851 | tmp = (reg - CB_COLOR0_BASE) / 4; | ||
852 | track->cb_color_base_last[tmp] = ib[idx]; | 852 | track->cb_color_base_last[tmp] = ib[idx]; |
853 | track->cb_color_bo[tmp] = reloc->robj; | 853 | track->cb_color_bo[tmp] = reloc->robj; |
854 | break; | 854 | break; |
@@ -1324,6 +1324,8 @@ int r600_cs_parse(struct radeon_cs_parser *p) | |||
1324 | do { | 1324 | do { |
1325 | r = r600_cs_packet_parse(p, &pkt, p->idx); | 1325 | r = r600_cs_packet_parse(p, &pkt, p->idx); |
1326 | if (r) { | 1326 | if (r) { |
1327 | kfree(p->track); | ||
1328 | p->track = NULL; | ||
1327 | return r; | 1329 | return r; |
1328 | } | 1330 | } |
1329 | p->idx += pkt.count + 2; | 1331 | p->idx += pkt.count + 2; |
@@ -1339,10 +1341,12 @@ int r600_cs_parse(struct radeon_cs_parser *p) | |||
1339 | default: | 1341 | default: |
1340 | DRM_ERROR("Unknown packet type %d !\n", pkt.type); | 1342 | DRM_ERROR("Unknown packet type %d !\n", pkt.type); |
1341 | kfree(p->track); | 1343 | kfree(p->track); |
1344 | p->track = NULL; | ||
1342 | return -EINVAL; | 1345 | return -EINVAL; |
1343 | } | 1346 | } |
1344 | if (r) { | 1347 | if (r) { |
1345 | kfree(p->track); | 1348 | kfree(p->track); |
1349 | p->track = NULL; | ||
1346 | return r; | 1350 | return r; |
1347 | } | 1351 | } |
1348 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); | 1352 | } while (p->idx < p->chunks[p->chunk_ib_idx].length_dw); |
@@ -1353,6 +1357,7 @@ int r600_cs_parse(struct radeon_cs_parser *p) | |||
1353 | } | 1357 | } |
1354 | #endif | 1358 | #endif |
1355 | kfree(p->track); | 1359 | kfree(p->track); |
1360 | p->track = NULL; | ||
1356 | return 0; | 1361 | return 0; |
1357 | } | 1362 | } |
1358 | 1363 | ||