diff options
author | Dave Airlie <airlied@redhat.com> | 2018-05-16 22:00:17 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2018-05-16 22:00:17 -0400 |
commit | 3d3aa969cbb4f0a5586798de7885309c6550af18 (patch) | |
tree | b336179865b7845474ed7f9ef602bead71ab3c8b | |
parent | 76ef6b28ea4f81c3d511866a9b31392caa833126 (diff) | |
parent | 2b6207291b7b277a5df9d1aab44b56815a292dba (diff) |
Merge tag 'drm-misc-fixes-2018-05-16' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
- core: Fix regression in dev node offsets (Haneen)
- vc4: Fix memory leak on driver close (Eric)
- dumb-buffers: Prevent overflow in DIV_ROUND_UP() (Dan)
Cc: Haneen Mohammed <hamohammed.sa@gmail.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Dan Carpenter <dan.carpenter@oracle.com>
* tag 'drm-misc-fixes-2018-05-16' of git://anongit.freedesktop.org/drm/drm-misc:
drm/dumb-buffers: Integer overflow in drm_mode_create_ioctl()
drm/vc4: Fix leak of the file_priv that stored the perfmon.
drm: Match sysfs name in link removal to link creation
-rw-r--r-- | drivers/gpu/drm/drm_drv.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_dumb_buffers.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/vc4/vc4_drv.c | 1 |
3 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index a1b9338736e3..c2c21d839727 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -716,7 +716,7 @@ static void remove_compat_control_link(struct drm_device *dev) | |||
716 | if (!minor) | 716 | if (!minor) |
717 | return; | 717 | return; |
718 | 718 | ||
719 | name = kasprintf(GFP_KERNEL, "controlD%d", minor->index); | 719 | name = kasprintf(GFP_KERNEL, "controlD%d", minor->index + 64); |
720 | if (!name) | 720 | if (!name) |
721 | return; | 721 | return; |
722 | 722 | ||
diff --git a/drivers/gpu/drm/drm_dumb_buffers.c b/drivers/gpu/drm/drm_dumb_buffers.c index 39ac15ce4702..9e2ae02f31e0 100644 --- a/drivers/gpu/drm/drm_dumb_buffers.c +++ b/drivers/gpu/drm/drm_dumb_buffers.c | |||
@@ -65,12 +65,13 @@ int drm_mode_create_dumb_ioctl(struct drm_device *dev, | |||
65 | return -EINVAL; | 65 | return -EINVAL; |
66 | 66 | ||
67 | /* overflow checks for 32bit size calculations */ | 67 | /* overflow checks for 32bit size calculations */ |
68 | /* NOTE: DIV_ROUND_UP() can overflow */ | 68 | if (args->bpp > U32_MAX - 8) |
69 | return -EINVAL; | ||
69 | cpp = DIV_ROUND_UP(args->bpp, 8); | 70 | cpp = DIV_ROUND_UP(args->bpp, 8); |
70 | if (!cpp || cpp > 0xffffffffU / args->width) | 71 | if (cpp > U32_MAX / args->width) |
71 | return -EINVAL; | 72 | return -EINVAL; |
72 | stride = cpp * args->width; | 73 | stride = cpp * args->width; |
73 | if (args->height > 0xffffffffU / stride) | 74 | if (args->height > U32_MAX / stride) |
74 | return -EINVAL; | 75 | return -EINVAL; |
75 | 76 | ||
76 | /* test for wrap-around */ | 77 | /* test for wrap-around */ |
diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index 94b99c90425a..7c95ed5c5cac 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c | |||
@@ -130,6 +130,7 @@ static void vc4_close(struct drm_device *dev, struct drm_file *file) | |||
130 | struct vc4_file *vc4file = file->driver_priv; | 130 | struct vc4_file *vc4file = file->driver_priv; |
131 | 131 | ||
132 | vc4_perfmon_close_file(vc4file); | 132 | vc4_perfmon_close_file(vc4file); |
133 | kfree(vc4file); | ||
133 | } | 134 | } |
134 | 135 | ||
135 | static const struct vm_operations_struct vc4_vm_ops = { | 136 | static const struct vm_operations_struct vc4_vm_ops = { |