linux_dsm_epyc7002/drivers/gpu/drm/gma500
Thomas Zimmermann 06ad8d3395 drm/gma500: Fix out-of-bounds access to struct drm_device.vblank[]
The gma500 driver expects 3 pipelines in several it's IRQ functions.
Accessing struct drm_device.vblank[], this fails with devices that only
have 2 pipelines. An example KASAN report is shown below.

  [   62.267688] ==================================================================
  [   62.268856] BUG: KASAN: slab-out-of-bounds in psb_irq_postinstall+0x250/0x3c0 [gma500_gfx]
  [   62.269450] Read of size 1 at addr ffff8880012bc6d0 by task systemd-udevd/285
  [   62.269949]
  [   62.270192] CPU: 0 PID: 285 Comm: systemd-udevd Tainted: G            E     5.10.0-rc1-1-default+ #572
  [   62.270807] Hardware name:  /DN2800MT, BIOS MTCDT10N.86A.0164.2012.1213.1024 12/13/2012
  [   62.271366] Call Trace:
  [   62.271705]  dump_stack+0xae/0xe5
  [   62.272180]  print_address_description.constprop.0+0x17/0xf0
  [   62.272987]  ? psb_irq_postinstall+0x250/0x3c0 [gma500_gfx]
  [   62.273474]  __kasan_report.cold+0x20/0x38
  [   62.273989]  ? psb_irq_postinstall+0x250/0x3c0 [gma500_gfx]
  [   62.274460]  kasan_report+0x3a/0x50
  [   62.274891]  psb_irq_postinstall+0x250/0x3c0 [gma500_gfx]
  [   62.275380]  drm_irq_install+0x131/0x1f0
  <...>
  [   62.300751] Allocated by task 285:
  [   62.301223]  kasan_save_stack+0x1b/0x40
  [   62.301731]  __kasan_kmalloc.constprop.0+0xbf/0xd0
  [   62.302293]  drmm_kmalloc+0x55/0x100
  [   62.302773]  drm_vblank_init+0x77/0x210

Resolve the issue by only handling vblank entries up to the number of
CRTCs.

I'm adding a Fixes tag for reference, although the bug has been present
since the driver's initial commit.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Fixes: 5c49fd3aa0 ("gma500: Add the core DRM files and headers")
Cc: Alan Cox <alan@linux.intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Cc: stable@vger.kernel.org#v3.3+
Link: https://patchwork.freedesktop.org/patch/msgid/20201105190256.3893-1-tzimmermann@suse.de
2020-11-09 15:09:52 +01:00
..
accel_2d.c drm/gma500: fix null dereference of pointer fb before null check 2019-12-19 15:33:40 +01:00
backlight.c
blitter.c
blitter.h
cdv_device.c
cdv_device.h
cdv_intel_crt.c drm/gma500: Use simple encoder 2020-04-02 14:16:44 +02:00
cdv_intel_display.c drm/gma500: Convert to CRTC VBLANK callbacks 2020-02-13 13:08:13 +01:00
cdv_intel_dp.c drm/gma500: fix error check 2020-08-19 15:49:10 +02:00
cdv_intel_hdmi.c drm/gma500: Use simple encoder 2020-04-02 14:16:44 +02:00
cdv_intel_lvds.c drm/gma500: Remove dead code 2020-04-21 09:02:29 +02:00
framebuffer.c drm/gma500: Constify static structs 2020-09-01 15:30:27 +02:00
framebuffer.h drm/gma500: Remove struct psb_fbdev 2019-11-25 11:19:31 +01:00
gem.c drm/gma500: remove _unlocked suffix in drm_gem_object_put_unlocked 2020-05-19 22:31:32 +01:00
gem.h
gma_device.c
gma_device.h
gma_display.c drm/gma500: remove _unlocked suffix in drm_gem_object_put_unlocked 2020-05-19 22:31:32 +01:00
gma_display.h drm/gma500: Add page flip support on psb/cdv 2019-11-07 10:16:31 +01:00
gtt.c remove ioremap_nocache and devm_ioremap_nocache 2020-01-06 09:45:59 +01:00
gtt.h
intel_bios.c
intel_bios.h drm/gma500/intel_bios.h: Replace zero-length array with flexible-array member 2020-03-06 11:40:53 +01:00
intel_gmbus.c
intel_i2c.c
Kconfig
Makefile
mdfld_device.c drm: gma500: Convert to GPIO descriptors 2020-08-19 15:48:09 +02:00
mdfld_dsi_dpi.c drm: gma500: Convert to GPIO descriptors 2020-08-19 15:48:09 +02:00
mdfld_dsi_dpi.h
mdfld_dsi_output.c drm: gma500: Convert to GPIO descriptors 2020-08-19 15:48:09 +02:00
mdfld_dsi_output.h drm: gma500: Convert to GPIO descriptors 2020-08-19 15:48:09 +02:00
mdfld_dsi_pkg_sender.c
mdfld_dsi_pkg_sender.h
mdfld_intel_display.c drm/gma500: Remove dead code 2020-04-21 09:02:29 +02:00
mdfld_output.c
mdfld_output.h drm: gma500: Convert to GPIO descriptors 2020-08-19 15:48:09 +02:00
mdfld_tmd_vid.c drm/gma500: Use simple encoder 2020-04-02 14:16:44 +02:00
mdfld_tpo_vid.c drm/gma500: Use simple encoder 2020-04-02 14:16:44 +02:00
mid_bios.c
mid_bios.h
mmu.c
mmu.h
oaktrail_crtc.c
oaktrail_device.c
oaktrail_hdmi_i2c.c
oaktrail_hdmi.c drm/gma500: remove unused variable 'hdmi_ids' 2020-04-21 08:15:03 +02:00
oaktrail_lvds_i2c.c
oaktrail_lvds.c drm/gma500: Use simple encoder 2020-04-02 14:16:44 +02:00
oaktrail.h
opregion.c
opregion.h
power.c
power.h
psb_device.c
psb_device.h
psb_drv.c drm/gma500: Use lockless gem BO free callback 2020-05-19 22:31:30 +01:00
psb_drv.h drm/gma500: Convert to CRTC VBLANK callbacks 2020-02-13 13:08:13 +01:00
psb_intel_display.c drm/gma500: Convert to CRTC VBLANK callbacks 2020-02-13 13:08:13 +01:00
psb_intel_drv.h drm: gma500: Convert to GPIO descriptors 2020-08-19 15:48:09 +02:00
psb_intel_lvds.c drm/gma500: Use simple encoder 2020-04-02 14:16:44 +02:00
psb_intel_modes.c
psb_intel_reg.h
psb_intel_sdvo_regs.h
psb_intel_sdvo.c drm/gma500: fix spelling mistake "pannel" -> "panel" 2020-08-10 14:15:30 +02:00
psb_irq.c drm/gma500: Fix out-of-bounds access to struct drm_device.vblank[] 2020-11-09 15:09:52 +01:00
psb_irq.h drm/gma500: Convert to CRTC VBLANK callbacks 2020-02-13 13:08:13 +01:00
psb_lid.c
psb_reg.h
tc35876x-dsi-lvds.c drm/gma500: Use simple encoder 2020-04-02 14:16:44 +02:00
tc35876x-dsi-lvds.h