Skip to contentSkip to conversation

vmwgfx: Fix unitialized stack read in vmw_setup_otable_base

PATCH Dave Jones 2 participants 2 messages Jan 31, 2014 – Feb 5, 2014

Subsystems (3)
lore
Share & tools
lore

Dave Jones

author
#0 lore raw

One of the error paths in vmw_setup_otable_base causes us to return with 'ret' having never been set to anything causing us to return whatever was on the stack.

Found with Coverity

drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +1 -0
index 4910e7b81811..d4a5a19cb8c3 100644
@@ -134,6 +134,7 @@ static int vmw_setup_otable_base(struct vmw_private *dev_priv,
 	cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd));
 	if (unlikely(cmd == NULL)) {
 		DRM_ERROR("Failed reserving FIFO space for OTable setup.\n");
+		ret = -ENOMEM;
 		goto out_no_fifo;
 	}
 
#1 lore raw
Quoted 13 lines · Dave Jones

One of the error paths in vmw_setup_otable_base causes us to return with 'ret' having never been set to anything causing us to return whatever was on the stack.

Found with Coverity

drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +0 -0
index 4910e7b81811..d4a5a19cb8c3 100644

drivers/gpu/drm/vmwgfx/vmwgfx_mob.c static int vmw_setup_otable_base(struct vmw_private *dev_priv, · line 140

Quoted 7 lines
drivers/gpu/drm/vmwgfx/vmwgfx_mob.c +1 -0
@@ -134,6 +134,7 @@ static int vmw_setup_otable_base(struct vmw_private *dev_priv,
 	cmd = vmw_fifo_reserve(dev_priv, sizeof(*cmd));
 	if (unlikely(cmd == NULL)) {
 		DRM_ERROR("Failed reserving FIFO space for OTable setup.\n");
+		ret = -ENOMEM;
 		goto out_no_fifo;
 	}
 

Thanks,
Will queue on vmwgfx-fixes for -rc2.

/Thomas