Merge tag 'drm-misc-next-fixes-2021-09-09' of git://anongit.freedesktop.org/drm/drm...
authorDave Airlie <airlied@redhat.com>
Fri, 10 Sep 2021 04:18:33 +0000 (14:18 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 10 Sep 2021 04:18:49 +0000 (14:18 +1000)
drm-misc-next-fixes for v5.15:
- Make some dma-buf config options depend on DMA_SHARED_BUFFER.
- Handle multiplication overflow of fbdev xres/yres in the core.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/37c5fe2e-5be8-45c3-286b-d8d536a5cef2@linux.intel.com
drivers/dma-buf/Kconfig
drivers/video/fbdev/core/fbmem.c

index 9561e3d..541efe0 100644 (file)
@@ -42,6 +42,7 @@ config UDMABUF
 config DMABUF_MOVE_NOTIFY
        bool "Move notify between drivers (EXPERIMENTAL)"
        default n
+       depends on DMA_SHARED_BUFFER
        help
          Don't pin buffers if the dynamic DMA-buf interface is available on
          both the exporter as well as the importer. This fixes a security
@@ -52,6 +53,7 @@ config DMABUF_MOVE_NOTIFY
 
 config DMABUF_DEBUG
        bool "DMA-BUF debug checks"
+       depends on DMA_SHARED_BUFFER
        default y if DMA_API_DEBUG
        help
          This option enables additional checks for DMA-BUF importers and
@@ -74,7 +76,7 @@ menuconfig DMABUF_HEAPS
 
 menuconfig DMABUF_SYSFS_STATS
        bool "DMA-BUF sysfs statistics"
-       select DMA_SHARED_BUFFER
+       depends on DMA_SHARED_BUFFER
        help
           Choose this option to enable DMA-BUF sysfs statistics
           in location /sys/kernel/dmabuf/buffers.
index 71fb710..7420d2c 100644 (file)
@@ -962,6 +962,7 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
        struct fb_var_screeninfo old_var;
        struct fb_videomode mode;
        struct fb_event event;
+       u32 unused;
 
        if (var->activate & FB_ACTIVATE_INV_MODE) {
                struct fb_videomode mode1, mode2;
@@ -1008,6 +1009,11 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)
        if (var->xres < 8 || var->yres < 8)
                return -EINVAL;
 
+       /* Too huge resolution causes multiplication overflow. */
+       if (check_mul_overflow(var->xres, var->yres, &unused) ||
+           check_mul_overflow(var->xres_virtual, var->yres_virtual, &unused))
+               return -EINVAL;
+
        ret = info->fbops->fb_check_var(var, info);
 
        if (ret)