Skip to contentSkip to conversation

drm/radeon/kms: fix potential segfault in r600_ioctl_wait_idle

PATCH New Alex Deucher 1 participant 1 message Sep 27, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon/kms: fix potential segfault in r600_ioctl_wait_idle

radeon_gem_wait_idle_ioctl can apparently get called prior to the vram page being set up or even if accel if false, so make sure it's valid before using it.

Should fix:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=597636
https://bugs.freedesktop.org/show_bug.cgi?id=29834

---
 drivers/gpu/drm/radeon/r600.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpu/drm/radeon/r600.c +2 -1
index 30a51c3..31f45af 100644
@@ -3491,7 +3491,8 @@ void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo)
 	/* r7xx hw bug.  write to HDP_DEBUG1 followed by fb read
 	 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL
 	 */
-	if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740)) {
+	if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) &&
+	    rdev->vram_scratch.ptr) {
 		void __iomem *ptr = (void *)rdev->vram_scratch.ptr;
 		u32 tmp;
 
Signature · 1 line
1.7.1.1