linux-stable/drivers/gpu/drm
Xiaomeng Tong 8d37abe2c0 stm: ltdc: fix two incorrect NULL checks on list iterator
commit 2e6c86be0e upstream.

The two bugs are here:
	if (encoder) {
	if (bridge && bridge->timings)

The list iterator value 'encoder/bridge' will *always* be set and
non-NULL by drm_for_each_encoder()/list_for_each_entry(), so it is
incorrect to assume that the iterator value will be NULL if the
list is empty or no element is found.

To fix the bug, use a new variable '*_iter' as the list iterator,
while use the old variable 'encoder/bridge' as a dedicated pointer
to point to the found element.

Cc: stable@vger.kernel.org
Fixes: 99e360442f ("drm/stm: Fix bus_flags handling")
Signed-off-by: Xiaomeng Tong <xiam0nd.tong@gmail.com>
Acked-by: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
Signed-off-by: Philippe Cornu <philippe.cornu@foss.st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220327055355.3808-1-xiam0nd.tong@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-06-09 10:26:28 +02:00
..
amd drm/amdgpu/cs: make commands with 0 chunks illegal behaviour. 2022-06-09 10:26:24 +02:00
arm drm: mali-dp: potential dereference of null pointer 2022-06-09 10:25:39 +02:00
armada Char/Misc driver update for 5.16-rc1 2021-11-04 08:21:47 -07:00
aspeed Linux 5.16-rc5 2021-12-14 10:24:28 +01:00
ast Revert "drm/ast: Support 1600x900 with 108MHz PCLK" 2022-01-26 10:26:51 +01:00
atmel-hlcdc drm: Remove CONFIG_DRM_KMS_CMA_HELPER option 2021-11-30 11:10:03 +01:00
bridge drm/bridge: analogix_dp: Grab runtime PM reference for DP-AUX 2022-06-09 10:26:24 +02:00
etnaviv drm/etnaviv: check for reaped mapping in etnaviv_iommu_unmap_gem 2022-06-09 10:26:24 +02:00
exynos drm/exynos: Search for TE-gpio in DSI panel's node 2022-02-25 09:50:48 +09:00
fsl-dcu drm: fsl-dcu: select CONFIG_DRM_GEM_CMA_HELPER 2021-12-06 09:30:16 +01:00
gma500 drm/gma500: Remove generic DRM drivers in probe function 2021-10-21 09:32:51 +02:00
gud drm/format-helper: Rework format-helper conversion functions 2021-11-11 12:06:57 +01:00
hisilicon drm: Remove CONFIG_DRM_KMS_CMA_HELPER option 2021-11-30 11:10:03 +01:00
hyperv Linux 5.16-rc5 2021-12-14 10:24:28 +01:00
i2c
i810
i915 drm/i915/dsi: fix VBT send packet port selection for ICL+ 2022-06-09 10:26:24 +02:00
imx drm/imx: dw_hdmi-imx: Fix bailout in error cases of probe 2022-04-13 19:27:29 +02:00
ingenic drm: Remove CONFIG_DRM_KMS_CMA_HELPER option 2021-11-30 11:10:03 +01:00
kmb drm/kmb: Fix for build errors with Warray-bounds 2022-01-27 14:30:36 -08:00
lib
lima Linux 5.16-rc5 2021-12-14 10:24:28 +01:00
mcde drm: Remove CONFIG_DRM_KMS_CMA_HELPER option 2021-11-30 11:10:03 +01:00
mediatek drm/mediatek: dpi: Use mt8183 output formats for mt8192 2022-06-09 10:25:41 +02:00
meson drm/meson: Fix error handling when afbcd.ops->init fails 2022-04-08 13:57:54 +02:00
mga drm/mga/mga_ioc32: Use struct_group() for memcpy() region 2021-09-25 08:20:48 -07:00
mgag200 mgag200 fix memmapsl configuration in GCTL6 register 2022-04-08 13:57:27 +02:00
msm drm/msm/dpu: fix error check return value of irq_of_parse_and_map() 2022-06-09 10:26:05 +02:00
mxsfb drm: mxsfb: Fix NULL pointer dereference 2022-02-03 09:31:16 +01:00
nouveau drm/nouveau/kms/nv50-: atom: fix an incorrect NULL check on list iterator 2022-06-09 10:26:24 +02:00
omapdrm drm/omap: fix NULL but dereferenced coccicheck error 2022-06-09 10:25:36 +02:00
panel drm/panel: panel-simple: Fix proper bpc for AM-1280800N3TZQW-T00H 2022-06-09 10:25:46 +02:00
panfrost drm/panfrost: Check for error num after setting mask 2022-04-08 13:57:55 +02:00
pl111 drm: Remove CONFIG_DRM_KMS_CMA_HELPER option 2021-11-30 11:10:03 +01:00
qxl drm/qxl: use iterator instead of dma_resv_shared_list 2021-11-30 14:53:02 +01:00
r128 Linux 5.15-rc7 2021-10-28 14:59:38 +10:00
radeon drm/radeon: fix logic inversion in radeon_sync_resv 2022-04-27 14:41:12 +02:00
rcar-du drm-misc-next for 5.17: 2021-12-10 15:08:21 +10:00
rockchip drm/rockchip: vop: fix possible null-ptr-deref in vop_bind() 2022-06-09 10:25:46 +02:00
savage
scheduler drm-misc-next for 5.17: 2021-11-23 09:38:55 +10:00
selftests drm/selftests/test-drm_dp_mst_helper: Fix memory leak in sideband_msg_req_encode_decode 2022-04-08 13:57:56 +02:00
shmobile drm: Remove CONFIG_DRM_KMS_CMA_HELPER option 2021-11-30 11:10:03 +01:00
sis
sprd drm/sprd: check the platform_get_resource() return value 2022-04-13 19:27:15 +02:00
sti drm: Remove CONFIG_DRM_KMS_CMA_HELPER option 2021-11-30 11:10:03 +01:00
stm stm: ltdc: fix two incorrect NULL checks on list iterator 2022-06-09 10:26:28 +02:00
sun4i drm/sun4i: Remove obsolete references to PHYS_OFFSET 2022-05-09 09:16:24 +02:00
tdfx
tegra drm/tegra: gem: Do not try to dereference ERR_PTR() 2022-06-09 10:25:24 +02:00
tidss drm: Remove CONFIG_DRM_KMS_CMA_HELPER option 2021-11-30 11:10:03 +01:00
tilcdc drm: Remove CONFIG_DRM_KMS_CMA_HELPER option 2021-11-30 11:10:03 +01:00
tiny drm/simpledrm: Add "panel orientation" property on non-upright mounted LCD panels 2022-04-08 13:57:22 +02:00
ttm Two DT bindings fixes for meson, a device refcounting fix for sun4i, a 2022-01-14 15:17:17 +01:00
tve200 drm: Remove CONFIG_DRM_KMS_CMA_HELPER option 2021-11-30 11:10:03 +01:00
udl drm/udl: fix control-message timeout 2021-11-05 11:15:14 +01:00
v3d drm/v3d: Fix null pointer dereference of pointer perfmon 2022-06-09 10:25:44 +02:00
vboxvideo drm: Move nomodeset kernel parameter to the DRM subsystem 2021-11-27 13:52:22 +01:00
vc4 drm/vc4: txp: Force alpha to be 0xff if it's disabled 2022-06-09 10:25:38 +02:00
vgem drm: Return error codes from struct drm_driver.gem_create_object 2021-12-02 11:12:39 +01:00
via
virtio drm/virtio: fix NULL pointer dereference in virtio_gpu_conn_get_modes 2022-06-09 10:25:18 +02:00
vkms
vmwgfx drm/vmwgfx: Fix an invalid read 2022-06-09 10:25:36 +02:00
xen Linux 5.16-rc5 2021-12-14 10:24:28 +01:00
xlnx sound updates for 5.17-rc1 2022-01-14 14:55:38 +01:00
drm_agpsupport.c
drm_aperture.c
drm_atomic.c Merge drm/drm-fixes into drm-misc-fixes 2022-01-26 09:40:24 +01:00
drm_atomic_helper.c drm: fix error found in some cases after the patch d1af5cd86997 2022-01-14 14:31:54 +01:00
drm_atomic_state_helper.c
drm_atomic_uapi.c drm/atomic: Don't pollute crtc_state->mode_blob with error pointers 2022-02-16 12:32:07 +02:00
drm_auth.c drm: get rid of DRM_DEBUG_* log calls in drm core, files drm_a*.c 2021-11-26 16:45:22 +01:00
drm_blend.c
drm_bridge.c drm/bridge: Document the probe issue with MIPI-DSI bridges 2021-09-24 19:25:23 +02:00
drm_bridge_connector.c drm/bridge_connector: enable HPD by default if supported 2022-06-09 10:25:36 +02:00
drm_bufs.c
drm_cache.c treewide: Replace the use of mem_encrypt_active() with cc_platform_has() 2021-10-04 11:47:24 +02:00
drm_client.c
drm_client_modeset.c Revert "drm: cleanup: drm_modeset_lock_all_ctx() --> DRM_MODESET_LOCK_ALL_BEGIN()" 2021-10-04 09:34:57 -04:00
drm_color_mgmt.c
drm_connector.c drm/vrr: Set VRR capable prop only if it is attached to connector 2022-03-01 11:37:21 -08:00
drm_context.c
drm_crtc.c
drm_crtc_helper.c Revert "drm: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()" 2021-10-04 09:34:57 -04:00
drm_crtc_helper_internal.h
drm_crtc_internal.h
drm_damage_helper.c
drm_debugfs.c
drm_debugfs_crc.c
drm_displayid.c
drm_dma.c
drm_dp_aux_bus.c
drm_dp_aux_dev.c
drm_dp_cec.c
drm_dp_dual_mode_helper.c
drm_dp_helper.c drm/dp: Fix OOB read when handling Post Cursor2 register 2022-04-08 13:58:12 +02:00
drm_dp_mst_topology.c drm/dp/mst: fix a possible memory leak in fetch_monitor_name() 2022-05-25 09:59:04 +02:00
drm_dp_mst_topology_internal.h
drm_drv.c drm: fix null-ptr-deref in drm_dev_init_release() 2021-10-14 21:39:02 +02:00
drm_dsc.c
drm_dumb_buffers.c
drm_edid.c drm/edid: fix invalid EDID extension block filtering 2022-06-09 10:25:36 +02:00
drm_edid_load.c
drm_encoder.c
drm_encoder_slave.c
drm_fb_cma_helper.c
drm_fb_helper.c drm/fb-helper: Mark screen buffers in system memory with FBINFO_VIRTFB 2022-04-08 13:57:30 +02:00
drm_file.c
drm_flip_work.c
drm_format_helper.c drm/format-helper: Add drm_fb_xrgb8888_to_xrgb2101010_toio() 2021-12-16 11:06:30 +01:00
drm_fourcc.c drm/fourcc: Add packed 10bit YUV 4:2:0 format 2021-12-16 11:23:22 +01:00
drm_framebuffer.c Revert "drm: cleanup: drm_modeset_lock_all() --> DRM_MODESET_LOCK_ALL_BEGIN()" 2021-10-04 09:34:57 -04:00
drm_gem.c drm: use new iterator in drm_gem_fence_array_add_implicit v3 2021-10-07 14:49:11 +02:00
drm_gem_atomic_helper.c drm: use new iterator in drm_gem_plane_helper_prepare_fb v3 2021-10-25 09:33:22 +02:00
drm_gem_cma_helper.c drm/cma-helper: Set VM_DONTEXPAND for mmap 2022-02-11 12:11:59 -05:00
drm_gem_framebuffer_helper.c dma-buf: move dma-buf symbols into the DMA_BUF module namespace 2021-10-25 14:53:08 +02:00
drm_gem_shmem_helper.c Linux 5.16-rc5 2021-12-14 10:24:28 +01:00
drm_gem_ttm_helper.c
drm_gem_vram_helper.c drm: Return error codes from struct drm_driver.gem_create_object 2021-12-02 11:12:39 +01:00
drm_hashtab.c drm: Declare hashtable as legacy 2021-11-30 09:41:28 +01:00
drm_hdcp.c
drm_internal.h
drm_ioc32.c
drm_ioctl.c
drm_irq.c drm: Build drm_irq.o only if CONFIG_DRM_LEGACY has been set 2021-10-22 16:20:12 +02:00
drm_kms_helper_common.c
drm_lease.c drm/lease: allow empty leases 2021-10-01 15:55:47 +02:00
drm_legacy.h drm: Declare hashtable as legacy 2021-11-30 09:41:28 +01:00
drm_legacy_misc.c
drm_lock.c
drm_managed.c
drm_memory.c
drm_mipi_dbi.c drm/mipi-dbi: Fix source-buffer address in mipi_dbi_buf_copy 2022-01-14 14:43:02 +01:00
drm_mipi_dsi.c drm/mipi-dsi: Create devm device attachment 2021-09-24 19:25:33 +02:00
drm_mm.c lib/stackdepot: allow optional init and stack_table allocation by kvmalloc() 2022-01-22 08:33:37 +02:00
drm_mode_config.c
drm_mode_object.c
drm_modes.c
drm_modeset_helper.c
drm_modeset_lock.c lib/stackdepot: allow optional init and stack_table allocation by kvmalloc() 2022-01-22 08:33:37 +02:00
drm_nomodeset.c drm: Fix build error caused by missing drm_nomodeset.o 2021-11-27 21:05:58 +01:00
drm_of.c drm: of: Add drm_of_lvds_get_data_mapping 2021-10-14 20:47:30 +02:00
drm_panel.c
drm_panel_orientation_quirks.c drm: Add orientation quirk for GPD Win Max 2022-04-13 19:27:07 +02:00
drm_pci.c
drm_plane.c drm/plane: Move range check for format_count earlier 2022-06-09 10:25:23 +02:00
drm_plane_helper.c drm/plane-helper: fix uninitialized variable reference 2021-10-07 12:24:44 +02:00
drm_prime.c drm next/fixes for 5.16-rc1 2021-11-12 12:11:07 -08:00
drm_print.c
drm_privacy_screen.c drm/privacy-screen: Fix sphinx warning 2022-02-07 14:11:21 +01:00
drm_privacy_screen_x86.c drm/privacy-screen: honor acpi=off in detect_thinkpad_privacy_screen 2022-01-26 15:25:50 +01:00
drm_probe_helper.c drm/probe-helper: use drm_kms_helper_connector_hotplug_event 2021-11-02 14:27:14 +01:00
drm_property.c drm: property: Replace strncpy() with strscpy_pad() 2021-10-07 05:42:13 +03:00
drm_rect.c
drm_scatter.c
drm_scdc_helper.c
drm_self_refresh_helper.c
drm_simple_kms_helper.c
drm_syncobj.c drm/syncobj: flatten dma_fence_chains on transfer 2022-04-08 13:57:30 +02:00
drm_sysfs.c drm/sysfs: introduce drm_sysfs_connector_hotplug_event 2021-11-02 14:27:06 +01:00
drm_trace.h
drm_trace_points.c
drm_vblank.c
drm_vblank_work.c
drm_vm.c
drm_vma_manager.c
drm_writeback.c
Kconfig drm/sprd: add Unisoc's drm kms master 2021-12-10 12:36:52 +01:00
Makefile drm/sprd: add Unisoc's drm kms master 2021-12-10 12:36:52 +01:00