]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/vmwgfx: Handle vmalloc() failure in vmw_local_fifo_reserve()
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 27 Apr 2017 09:12:08 +0000 (12:12 +0300)
committerThomas Hellstrom <thellstrom@vmware.com>
Wed, 7 Jun 2017 10:07:35 +0000 (12:07 +0200)
If vmalloc() fails then we need to a bit of cleanup before returning.

Cc: <stable@vger.kernel.org>
Fixes: bfd3419f8525 ("drm/vmwgfx: Add DRM driver for VMware Virtual GPU")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Sinclair Yeh <syeh@vmware.com>
drivers/gpu/drm/vmwgfx/vmwgfx_fifo.c

index b6a0806b06bffaf6da9178905f9b2f6bb037d384..a1c68e6a689e32fd0dd4d74c805ee4afd0836a99 100644 (file)
@@ -368,6 +368,8 @@ static void *vmw_local_fifo_reserve(struct vmw_private *dev_priv,
                                return fifo_state->static_buffer;
                        else {
                                fifo_state->dynamic_buffer = vmalloc(bytes);
+                               if (!fifo_state->dynamic_buffer)
+                                       goto out_err;
                                return fifo_state->dynamic_buffer;
                        }
                }