1
0
Fork 0
alistair23-linux/drivers/gpu/drm/gma500
Thomas Zimmermann c6a6168a31 drm/gma500: Fix out-of-bounds access to struct drm_device.vblank[]
commit 06ad8d3395 upstream.

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
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-18 19:20:31 +01:00
..
Kconfig treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
accel_2d.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
backlight.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 335 2019-06-05 17:37:06 +02:00
blitter.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
blitter.h Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
cdv_device.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
cdv_device.h Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
cdv_intel_crt.c drm/gma500: drop drmp.h include from all .c files 2019-05-22 14:13:40 +02:00
cdv_intel_display.c gma/gma500: fix a memory disclosure bug due to uninitialized bytes 2020-10-01 13:17:13 +02:00
cdv_intel_dp.c drm/gma500: fix error check 2020-10-29 09:57:36 +01:00
cdv_intel_hdmi.c drm/gma500: drop drmp.h include from all .c files 2019-05-22 14:13:40 +02:00
cdv_intel_lvds.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
framebuffer.c drm/gma500: Fixup fbdev stolen size usage evaluation 2020-02-24 08:36:22 +01:00
framebuffer.h Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
gem.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
gem.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
gma_device.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
gma_device.h Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
gma_display.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
gma_display.h Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
gtt.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
gtt.h Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
intel_bios.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
intel_bios.h Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
intel_gmbus.c drm/gma500: drop drmp.h include from all .c files 2019-05-22 14:13:40 +02:00
intel_i2c.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
mdfld_device.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
mdfld_dsi_dpi.c drm/gma500: drop drmp.h include from all .c files 2019-05-22 14:13:40 +02:00
mdfld_dsi_dpi.h drm: Make the .mode_fixup() operations mode argument a const pointer 2012-07-19 21:52:38 -04:00
mdfld_dsi_output.c drm/gma500: drop drmp.h include from all .c files 2019-05-22 14:13:40 +02:00
mdfld_dsi_output.h drm/gma500: drop drmp.h include from all .c files 2019-05-22 14:13:40 +02:00
mdfld_dsi_pkg_sender.c drm/gma500: drop drmp.h include from all .c files 2019-05-22 14:13:40 +02:00
mdfld_dsi_pkg_sender.h drm/gma500: mdfld: Reuse video/mipi_display.h 2014-11-13 10:44:41 +01:00
mdfld_intel_display.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
mdfld_output.c gma500: mdfld_dsi_output_init() drop unused parameter 2012-03-10 13:05:51 +00:00
mdfld_output.h gma500: initial medfield merge 2012-03-10 13:05:48 +00:00
mdfld_tmd_vid.c drm/gma500: drop drmP.h from header files 2019-05-22 14:13:33 +02:00
mdfld_tpo_vid.c gpu: drm: gma500: remove two more dead variable 2017-05-23 17:38:33 +02:00
mid_bios.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
mid_bios.h Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
mmu.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
mmu.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
oaktrail.h Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
oaktrail_crtc.c drm/gma500: fix memory disclosures due to uninitialized bytes 2019-12-31 16:44:13 +01:00
oaktrail_device.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
oaktrail_hdmi.c drm/gma500: drop drmp.h include from all .c files 2019-05-22 14:13:40 +02:00
oaktrail_hdmi_i2c.c tree-wide: use reinit_completion instead of INIT_COMPLETION 2013-11-15 09:32:21 +09:00
oaktrail_lvds.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
oaktrail_lvds_i2c.c drm/gma500: drop drmp.h include from all .c files 2019-05-22 14:13:40 +02:00
opregion.c drm/gma500: remove unnecessary config_enabled() guard 2016-08-24 07:43:42 +02:00
opregion.h gma500: move the ASLE enable 2012-07-16 09:20:33 -07:00
power.c drm/gma500: use to_pci_dev() 2016-01-04 07:57:38 +01:00
power.h drm/gma500: drop drmP.h from header files 2019-05-22 14:13:33 +02:00
psb_device.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
psb_device.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 335 2019-06-05 17:37:06 +02:00
psb_drv.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
psb_drv.h Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
psb_intel_display.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
psb_intel_drv.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 335 2019-06-05 17:37:06 +02:00
psb_intel_lvds.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
psb_intel_modes.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
psb_intel_reg.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 335 2019-06-05 17:37:06 +02:00
psb_intel_sdvo.c drm/gma500: drop drmp.h include from all .c files 2019-05-22 14:13:40 +02:00
psb_intel_sdvo_regs.h
psb_irq.c drm/gma500: Fix out-of-bounds access to struct drm_device.vblank[] 2020-11-18 19:20:31 +01:00
psb_irq.h Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
psb_lid.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
psb_reg.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 335 2019-06-05 17:37:06 +02:00
tc35876x-dsi-lvds.c drm/gma500: drop drmp.h include from all .c files 2019-05-22 14:13:40 +02:00
tc35876x-dsi-lvds.h gma500: initial medfield merge 2012-03-10 13:05:48 +00:00