Commit 9b00147d authored by Alex Deucher's avatar Alex Deucher Committed by Dave Airlie

drm/radeon: fix regression in UMS CS ioctl

radeon_cs_parser_init is called by both the legacy UMS
CS ioctl and the KMS CS ioctl.  Protect KMS specific
pieces of the code by checking that rdev is not NULL.
Reported-by: default avatarMichael Burian <michael.burian@sbg.at>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarJerome Glisse <jglisse@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 0824db38
...@@ -147,6 +147,7 @@ static int radeon_cs_sync_rings(struct radeon_cs_parser *p) ...@@ -147,6 +147,7 @@ static int radeon_cs_sync_rings(struct radeon_cs_parser *p)
sync_to_ring, p->ring); sync_to_ring, p->ring);
} }
/* XXX: note that this is called from the legacy UMS CS ioctl as well */
int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
{ {
struct drm_radeon_cs *cs = data; struct drm_radeon_cs *cs = data;
...@@ -245,22 +246,24 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data) ...@@ -245,22 +246,24 @@ int radeon_cs_parser_init(struct radeon_cs_parser *p, void *data)
} }
} }
if ((p->cs_flags & RADEON_CS_USE_VM) && /* these are KMS only */
!p->rdev->vm_manager.enabled) { if (p->rdev) {
DRM_ERROR("VM not active on asic!\n"); if ((p->cs_flags & RADEON_CS_USE_VM) &&
return -EINVAL; !p->rdev->vm_manager.enabled) {
} DRM_ERROR("VM not active on asic!\n");
return -EINVAL;
/* we only support VM on SI+ */ }
if ((p->rdev->family >= CHIP_TAHITI) &&
((p->cs_flags & RADEON_CS_USE_VM) == 0)) {
DRM_ERROR("VM required on SI+!\n");
return -EINVAL;
}
if (radeon_cs_get_ring(p, ring, priority)) /* we only support VM on SI+ */
return -EINVAL; if ((p->rdev->family >= CHIP_TAHITI) &&
((p->cs_flags & RADEON_CS_USE_VM) == 0)) {
DRM_ERROR("VM required on SI+!\n");
return -EINVAL;
}
if (radeon_cs_get_ring(p, ring, priority))
return -EINVAL;
}
/* deal with non-vm */ /* deal with non-vm */
if ((p->chunk_ib_idx != -1) && if ((p->chunk_ib_idx != -1) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment