mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 16:08:04 +02:00
winsys/radeon: allow a NULL cs pointer in radeon_bo_map to fix a segfault
The original idea was that cs=NULL should be allowed here, but we never used
NULL until 862f69fbe1. This fixes a segfault in CoreBreach.
This commit is contained in:
parent
8d4ac98549
commit
06b38dbab2
1 changed files with 11 additions and 9 deletions
|
|
@ -458,7 +458,7 @@ static void *radeon_bo_map(struct radeon_winsys_cs_handle *buf,
|
|||
* (neither one is changing it).
|
||||
*
|
||||
* Only check whether the buffer is being used for write. */
|
||||
if (radeon_bo_is_referenced_by_cs_for_write(cs, bo)) {
|
||||
if (cs && radeon_bo_is_referenced_by_cs_for_write(cs, bo)) {
|
||||
cs->flush_cs(cs->flush_data, RADEON_FLUSH_ASYNC);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -468,7 +468,7 @@ static void *radeon_bo_map(struct radeon_winsys_cs_handle *buf,
|
|||
return NULL;
|
||||
}
|
||||
} else {
|
||||
if (radeon_bo_is_referenced_by_cs(cs, bo)) {
|
||||
if (cs && radeon_bo_is_referenced_by_cs(cs, bo)) {
|
||||
cs->flush_cs(cs->flush_data, RADEON_FLUSH_ASYNC);
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -489,19 +489,21 @@ static void *radeon_bo_map(struct radeon_winsys_cs_handle *buf,
|
|||
* (neither one is changing it).
|
||||
*
|
||||
* Only check whether the buffer is being used for write. */
|
||||
if (radeon_bo_is_referenced_by_cs_for_write(cs, bo)) {
|
||||
if (cs && radeon_bo_is_referenced_by_cs_for_write(cs, bo)) {
|
||||
cs->flush_cs(cs->flush_data, 0);
|
||||
}
|
||||
radeon_bo_wait((struct pb_buffer*)bo,
|
||||
RADEON_USAGE_WRITE);
|
||||
} else {
|
||||
/* Mapping for write. */
|
||||
if (radeon_bo_is_referenced_by_cs(cs, bo)) {
|
||||
cs->flush_cs(cs->flush_data, 0);
|
||||
} else {
|
||||
/* Try to avoid busy-waiting in radeon_bo_wait. */
|
||||
if (p_atomic_read(&bo->num_active_ioctls))
|
||||
radeon_drm_cs_sync_flush(rcs);
|
||||
if (cs) {
|
||||
if (radeon_bo_is_referenced_by_cs(cs, bo)) {
|
||||
cs->flush_cs(cs->flush_data, 0);
|
||||
} else {
|
||||
/* Try to avoid busy-waiting in radeon_bo_wait. */
|
||||
if (p_atomic_read(&bo->num_active_ioctls))
|
||||
radeon_drm_cs_sync_flush(rcs);
|
||||
}
|
||||
}
|
||||
|
||||
radeon_bo_wait((struct pb_buffer*)bo, RADEON_USAGE_READWRITE);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue