linux-uconsole/drivers/gpu/drm/vmwgfx
Dan Carpenter dcd22e1478 drm/vmwgfx: Fix double free in vmw_recv_msg()
commit 08b0c89160 upstream.

We recently added a kfree() after the end of the loop:

	if (retries == RETRIES) {
		kfree(reply);
		return -EINVAL;
	}

There are two problems.  First the test is wrong and because retries
equals RETRIES if we succeed on the last iteration through the loop.
Second if we fail on the last iteration through the loop then the kfree
is a double free.

When you're reading this code, please note the break statement at the
end of the while loop.  This patch changes the loop so that if it's not
successful then "reply" is NULL and we can test for that afterward.

Cc: <stable@vger.kernel.org>
Fixes: 6b7c3b86f0 ("drm/vmwgfx: fix memory leak when too many retries have occurred")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-09-16 08:21:40 +02:00
..
device_include
Kconfig
Makefile
vmwgfx_binding.c
vmwgfx_binding.h
vmwgfx_blit.c
vmwgfx_bo.c
vmwgfx_cmdbuf.c
vmwgfx_cmdbuf_res.c
vmwgfx_context.c
vmwgfx_cotable.c
vmwgfx_drv.c drm/vmwgfx: fix a warning due to missing dma_parms 2019-07-14 08:11:09 +02:00
vmwgfx_drv.h
vmwgfx_execbuf.c drm/vmwgfx: NULL pointer dereference from vmw_cmd_dx_view_define() 2019-06-19 08:18:05 +02:00
vmwgfx_fb.c drm/vmwgfx: Don't double-free the mode stored in par->set_mode 2019-03-27 14:14:38 +09:00
vmwgfx_fence.c
vmwgfx_fence.h
vmwgfx_fifo.c
vmwgfx_gmr.c
vmwgfx_gmrid_manager.c drm/vmwgfx: Return 0 when gmrid::get_node runs out of ID's 2019-03-27 14:14:38 +09:00
vmwgfx_ioctl.c
vmwgfx_irq.c
vmwgfx_kms.c drm/vmwgfx: limit mode size for all display unit to texture_max 2018-09-20 08:00:03 +02:00
vmwgfx_kms.h
vmwgfx_ldu.c drm-misc-next for 4.19: 2018-07-20 10:46:49 +10:00
vmwgfx_marker.c
vmwgfx_mob.c
vmwgfx_msg.c drm/vmwgfx: Fix double free in vmw_recv_msg() 2019-09-16 08:21:40 +02:00
vmwgfx_msg.h
vmwgfx_overlay.c
vmwgfx_prime.c
vmwgfx_reg.h
vmwgfx_resource.c
vmwgfx_resource_priv.h
vmwgfx_scrn.c drm-misc-next for 4.19: 2018-07-20 10:46:49 +10:00
vmwgfx_shader.c
vmwgfx_simple_resource.c
vmwgfx_so.c
vmwgfx_so.h
vmwgfx_stdu.c drm/vmwgfx: Don't impose STDU limits on framebuffer size 2018-09-20 08:00:03 +02:00
vmwgfx_surface.c drm/vmwgfx: Don't impose STDU limits on framebuffer size 2018-09-20 08:00:03 +02:00
vmwgfx_ttm_buffer.c drm/vmwgfx: Honor the sg list segment size limitation 2019-07-14 08:11:09 +02:00
vmwgfx_ttm_glue.c
vmwgfx_va.c