drm/virtio: Use vmalloc for command buffer allocations.
Userspace requested command buffer allocations could be too large to make as a contiguous allocation. Use vmalloc if necessary to satisfy those allocations. Signed-off-by: David Riley <davidriley@chromium.org> Link: http://patchwork.freedesktop.org/patch/msgid/20190911181403.40909-3-davidriley@chromium.org Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:

committed by
Gerd Hoffmann

parent
32d6c2c5b5
commit
e1218b8c0c
@@ -143,7 +143,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
|
||||
goto out_unused_fd;
|
||||
}
|
||||
|
||||
buf = memdup_user(u64_to_user_ptr(exbuf->command), exbuf->size);
|
||||
buf = vmemdup_user(u64_to_user_ptr(exbuf->command), exbuf->size);
|
||||
if (IS_ERR(buf)) {
|
||||
ret = PTR_ERR(buf);
|
||||
goto out_unresv;
|
||||
@@ -172,7 +172,7 @@ static int virtio_gpu_execbuffer_ioctl(struct drm_device *dev, void *data,
|
||||
return 0;
|
||||
|
||||
out_memdup:
|
||||
kfree(buf);
|
||||
kvfree(buf);
|
||||
out_unresv:
|
||||
if (buflist)
|
||||
virtio_gpu_array_unlock_resv(buflist);
|
||||
|
Reference in New Issue
Block a user