Commit graph

342 commits

Author SHA1 Message Date
Antonio Quartulli
aa6358430a drm/amdgpu: prevent NULL pointer dereference if ATIF is not supported
commit a6dd15981c03f2cdc9a351a278f09b5479d53d2e upstream.

acpi_evaluate_object() may return AE_NOT_FOUND (failure), which
would result in dereferencing buffer.pointer (obj) while being NULL.

Although this case may be unrealistic for the current code, it is
still better to protect against possible bugs.

Bail out also when status is AE_NOT_FOUND.

This fixes 1 FORWARD_NULL issue reported by Coverity
Report: CID 1600951:  Null pointer dereferences  (FORWARD_NULL)

Signed-off-by: Antonio Quartulli <antonio@mandelbit.com>
Fixes: c9b7c809b89f ("drm/amd: Guard against bad data for ATIF ACPI method")
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20241031152848.4716-1-antonio@mandelbit.com
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 91c9e221fe2553edf2db71627d8453f083de87a1)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-30 02:33:24 +01:00
Alex Deucher
f440f3ca1f drm/amdgpu: add missing size check in amdgpu_debugfs_gprwave_read()
commit 4d75b9468021c73108b4439794d69e892b1d24e3 upstream.

Avoid a possible buffer overflow if size is larger than 4K.

Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit f5d873f5825b40d886d03bd2aede91d4cf002434)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-30 02:33:24 +01:00
Ksawlii
f9e1f3fa3a Revert "exynos_gpu: Don't allow userspace to control freqs"
This reverts commit fdef7b54c3.
2024-11-24 19:22:36 +01:00
Ksawlii
0f4d6c3c29 Revert "gpu/exynos: Make 'gpu_mm_min_clock' readonly too"
This reverts commit 9e6b7e114f.
2024-11-24 19:16:08 +01:00
Ksawlii
1ffb9c4abb Revert "drm: panel-orientation-quirks: Add quirk for OrangePi Neo"
This reverts commit 7dc65657e4.
2024-11-24 00:23:49 +01:00
Ksawlii
c187eb4fd5 Revert "drm/i915/fence: Mark debug_fence_init_onstack() with __maybe_unused"
This reverts commit 3ee84729fc.
2024-11-24 00:23:36 +01:00
Ksawlii
2d9bc5b4af Revert "drm/i915/fence: Mark debug_fence_free() with __maybe_unused"
This reverts commit 0bb1e0a912.
2024-11-24 00:23:36 +01:00
Ksawlii
37e508a03b Revert "drm/msm/adreno: Fix error return if missing firmware-name"
This reverts commit 114e57cc55.
2024-11-24 00:23:35 +01:00
Ksawlii
3a0492cae8 Revert "drm: komeda: Fix an issue related to normalized zpos"
This reverts commit f98965500e.
2024-11-24 00:23:33 +01:00
Ksawlii
3fe0cf26f0 Revert "drm/stm: Fix an error handling path in stm_drm_platform_probe()"
This reverts commit 03956d38af.
2024-11-24 00:23:26 +01:00
Ksawlii
f813cb6b0a Revert "drm/amdgpu: Replace one-element array with flexible-array member"
This reverts commit 8fae68c46a.
2024-11-24 00:23:26 +01:00
Ksawlii
d3c702a169 Revert "drm/amdgpu: properly handle vbios fake edid sizing"
This reverts commit 83535625d4.
2024-11-24 00:23:26 +01:00
Ksawlii
e7a0a0a989 Revert "drm/radeon: Replace one-element array with flexible-array member"
This reverts commit d0631885b7.
2024-11-24 00:23:26 +01:00
Ksawlii
ee73a3644c Revert "drm/radeon: properly handle vbios fake edid sizing"
This reverts commit 103f1f860c.
2024-11-24 00:23:26 +01:00
Ksawlii
32d14f5d13 Revert "drm/rockchip: vop: Allow 4096px width scaling"
This reverts commit d911780415.
2024-11-24 00:23:26 +01:00
Ksawlii
b83dd1217a Revert "drm/rockchip: dw_hdmi: Fix reading EDID when using a forced mode"
This reverts commit 7c596051d6.
2024-11-24 00:23:26 +01:00
Ksawlii
5321d71bb1 Revert "drm/radeon/evergreen_cs: fix int overflow errors in cs track offsets"
This reverts commit a339df473d.
2024-11-24 00:23:25 +01:00
Ksawlii
75d54cbe54 Revert "drm/msm: Fix incorrect file name output in adreno_request_fw()"
This reverts commit 4135fc06a3.
2024-11-24 00:23:25 +01:00
Ksawlii
8970e43037 Revert "drm/msm/a5xx: disable preemption in submits by default"
This reverts commit a5394161bf.
2024-11-24 00:23:25 +01:00
Ksawlii
f3d2c0c9ba Revert "drm/msm/a5xx: properly clear preemption records on resume"
This reverts commit fcb7824289.
2024-11-24 00:23:25 +01:00
Ksawlii
f007606619 Revert "drm/msm/a5xx: fix races in preemption evaluation stage"
This reverts commit 22746ff9a0.
2024-11-24 00:23:25 +01:00
Ksawlii
a33260418a Revert "drm/msm: Add priv->mm_lock to protect active/inactive lists"
This reverts commit 20d019dcd9.
2024-11-24 00:23:25 +01:00
Ksawlii
c18d247bc2 Revert "drm/msm: Drop priv->lastctx"
This reverts commit 77084c27bb.
2024-11-24 00:23:25 +01:00
Ksawlii
5aff368457 Revert "drm/msm/a5xx: workaround early ring-buffer emptiness check"
This reverts commit 2a3b8254f9.
2024-11-24 00:23:24 +01:00
Ksawlii
2b540eeaa5 Revert "drm/msm: fix %s null argument error"
This reverts commit d79cc74edb.
2024-11-24 00:23:24 +01:00
Ksawlii
3eed8cca41 Revert "drivers:drm:exynos_drm_gsc:Fix wrong assignment in gsc_bind()"
This reverts commit 8e094acfd9.
2024-11-24 00:23:24 +01:00
Ksawlii
c2a82d3cc4 Revert "drm/amd/display: Round calculated vtotal"
This reverts commit 033f56e503.
2024-11-24 00:23:17 +01:00
Ksawlii
3c13d72960 Revert "drm/amd/display: Initialize get_bytes_per_element's default to 1"
This reverts commit 293de81901.
2024-11-24 00:23:06 +01:00
Ksawlii
874d1dc60d Revert "drm/printer: Allow NULL data in devcoredump printer"
This reverts commit f39aaded93.
2024-11-24 00:23:06 +01:00
Ksawlii
d46c056a33 Revert "drm/radeon/r100: Handle unknown family in r100_cp_init_microcode()"
This reverts commit 33dff12c44.
2024-11-24 00:23:06 +01:00
Ksawlii
acc7fa319a Revert "drm/amd/pm: ensure the fw_info is not null before using it"
This reverts commit b8738df176.
2024-11-24 00:23:06 +01:00
Ksawlii
34c3ff3688 Revert "drm: Consistently use struct drm_mode_rect for FB_DAMAGE_CLIPS"
This reverts commit 444232b00b.
2024-11-24 00:23:04 +01:00
Ksawlii
086b0d40c1 Revert "drm: omapdrm: Add missing check for alloc_ordered_workqueue"
This reverts commit 6d2ca9e716.
2024-11-24 00:23:03 +01:00
Ksawlii
e136698c96 Revert "drm/sched: Add locking to drm_sched_entity_modify_sched"
This reverts commit 28800f44ce.
2024-11-24 00:23:01 +01:00
Ksawlii
c6f5d8db3c Revert "drm/rockchip: define gamma registers for RK3399"
This reverts commit cafee81fda.
2024-11-24 00:23:00 +01:00
Ksawlii
c0cb37d316 Revert "drm/rockchip: support gamma control on RK3399"
This reverts commit 36a33fc208.
2024-11-24 00:23:00 +01:00
Ksawlii
0652589731 Revert "drm/rockchip: vop: clear DMA stop bit on RK3066"
This reverts commit 7229c75404.
2024-11-24 00:23:00 +01:00
Ksawlii
615dcf3da9 Revert "drm/crtc: fix uninitialized variable use even harder"
This reverts commit 3522dcec50.
2024-11-24 00:22:59 +01:00
Ksawlii
72a3d14a18 Revert "drm/amd/display: Check null pointer before dereferencing se"
This reverts commit 61ab6d9aa6.
2024-11-24 00:22:57 +01:00
Ksawlii
7e10dfc7ee Revert "nouveau/dmem: Fix vulnerability in migrate_to_ram upon copy error"
This reverts commit 0486357541.
2024-11-24 00:22:55 +01:00
Ksawlii
9bf31e8691 Revert "drm/radeon: Fix encoder->possible_clones"
This reverts commit ff586b4f24.
2024-11-24 00:22:52 +01:00
Ksawlii
cd921badef Revert "drm/vmwgfx: Handle surface check failure correctly"
This reverts commit 9af2b41a3f.
2024-11-24 00:22:52 +01:00
Wachowski, Karol
56c4cfaa0f drm/shmem-helper: Fix BUG_ON() on mmap(PROT_WRITE, MAP_PRIVATE)
commit 39bc27bd688066a63e56f7f64ad34fae03fbe3b8 upstream.

Lack of check for copy-on-write (COW) mapping in drm_gem_shmem_mmap
allows users to call mmap with PROT_WRITE and MAP_PRIVATE flag
causing a kernel panic due to BUG_ON in vmf_insert_pfn_prot:
BUG_ON((vma->vm_flags & VM_PFNMAP) && is_cow_mapping(vma->vm_flags));

Return -EINVAL early if COW mapping is detected.

This bug affects all drm drivers using default shmem helpers.
It can be reproduced by this simple example:
void *ptr = mmap(0, size, PROT_WRITE, MAP_PRIVATE, fd, mmap_offset);
ptr[0] = 0;

Fixes: 2194a63a818d ("drm: Add library for shmem backed GEM objects")
Cc: Noralf Trønnes <noralf@tronnes.org>
Cc: Eric Anholt <eric@anholt.net>
Cc: Rob Herring <robh@kernel.org>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@gmail.com>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v5.2+
Signed-off-by: Wachowski, Karol <karol.wachowski@intel.com>
Signed-off-by: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20240520100514.925681-1-jacek.lawrynowicz@linux.intel.com
[ Artem: bp to fix CVE-2024-39497, in order to adapt this patch to branch 5.10
  add header file mm/internal.h]
Signed-off-by: Artem Sdvizhkov <raclesdv@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:22:06 +01:00
Jason-JH.Lin
1a6bf429eb Revert "drm/mipi-dsi: Set the fwnode for mipi_dsi_device"
This reverts commit 139c27648f8d3b2283f74715d8e7f0df7f5e55ca which is
commit a26cc2934331b57b5a7164bff344f0a2ec245fc0 upstream.

Reason for revert:
1. The commit [1] does not land on linux-5.15, so this patch does not
fix anything.

2. Since the fw_devlink improvements series [2] does not land on
linux-5.15, using device_set_fwnode() causes the panel to flash during
bootup.

Incorrect link management may lead to incorrect device initialization,
affecting firmware node links and consumer relationships.
The fwnode setting of panel to the DSI device would cause a DSI
initialization error without series[2], so this patch was reverted to
avoid using the incomplete fw_devlink functionality.

[1] commit 3fb16866b51d ("driver core: fw_devlink: Make cycle detection more robust")
[2] Link: https://lore.kernel.org/all/20230207014207.1678715-1-saravanak@google.com

Cc: stable@vger.kernel.org # 5.15.169
Cc: stable@vger.kernel.org # 5.10.228
Cc: stable@vger.kernel.org # 5.4.284
Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:22:06 +01:00
Mario Limonciello
2dd30f8c30 drm/amd: Guard against bad data for ATIF ACPI method
commit bf58f03931fdcf7b3c45cb76ac13244477a60f44 upstream.

If a BIOS provides bad data in response to an ATIF method call
this causes a NULL pointer dereference in the caller.

```
? show_regs (arch/x86/kernel/dumpstack.c:478 (discriminator 1))
? __die (arch/x86/kernel/dumpstack.c:423 arch/x86/kernel/dumpstack.c:434)
? page_fault_oops (arch/x86/mm/fault.c:544 (discriminator 2) arch/x86/mm/fault.c:705 (discriminator 2))
? do_user_addr_fault (arch/x86/mm/fault.c:440 (discriminator 1) arch/x86/mm/fault.c:1232 (discriminator 1))
? acpi_ut_update_object_reference (drivers/acpi/acpica/utdelete.c:642)
? exc_page_fault (arch/x86/mm/fault.c:1542)
? asm_exc_page_fault (./arch/x86/include/asm/idtentry.h:623)
? amdgpu_atif_query_backlight_caps.constprop.0 (drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:387 (discriminator 2)) amdgpu
? amdgpu_atif_query_backlight_caps.constprop.0 (drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c:386 (discriminator 1)) amdgpu
```

It has been encountered on at least one system, so guard for it.

Fixes: d38ceaf99ed0 ("drm/amdgpu: add core driver (v4)")
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit c9b7c809b89f24e9372a4e7f02d64c950b07fdee)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:22:01 +01:00
Hans de Goede
b9c4e3f0e5 drm/vboxvideo: Replace fake VLA at end of vbva_mouse_pointer_shape with real VLA
[ Upstream commit d92b90f9a54d9300a6e883258e79f36dab53bfae ]

Replace the fake VLA at end of the vbva_mouse_pointer_shape shape with
a real VLA to fix a "memcpy: detected field-spanning write error" warning:

[   13.319813] memcpy: detected field-spanning write (size 16896) of single field "p->data" at drivers/gpu/drm/vboxvideo/hgsmi_base.c:154 (size 4)
[   13.319841] WARNING: CPU: 0 PID: 1105 at drivers/gpu/drm/vboxvideo/hgsmi_base.c:154 hgsmi_update_pointer_shape+0x192/0x1c0 [vboxvideo]
[   13.320038] Call Trace:
[   13.320173]  hgsmi_update_pointer_shape [vboxvideo]
[   13.320184]  vbox_cursor_atomic_update [vboxvideo]

Note as mentioned in the added comment it seems the original length
calculation for the allocated and send hgsmi buffer is 4 bytes too large.
Changing this is not the goal of this patch, so this behavior is kept.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240827104523.17442-1-hdegoede@redhat.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:22:00 +01:00
Jonathan Marek
34b9267737 drm/msm/dsi: fix 32-bit signed integer extension in pclk_rate calculation
[ Upstream commit 358b762400bd94db2a14a72dfcef74c7da6bd845 ]

When (mode->clock * 1000) is larger than (1<<31), int to unsigned long
conversion will sign extend the int to 64 bits and the pclk_rate value
will be incorrect.

Fix this by making the result of the multiplication unsigned.

Note that above (1<<32) would still be broken and require more changes, but
its unlikely anyone will need that anytime soon.

Fixes: c4d8cfe516dc ("drm/msm/dsi: add implementation for helper functions")
Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/618434/
Link: https://lore.kernel.org/r/20241007050157.26855-2-jonathan@marek.ca
Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-23 23:21:58 +01:00
Nikolay Kuratov
9af2b41a3f drm/vmwgfx: Handle surface check failure correctly
commit 26498b8d54373d31a621d7dec95c4bd842563b3b upstream.

Currently if condition (!bo and !vmw_kms_srf_ok()) was met
we go to err_out with ret == 0.
err_out dereferences vfb if ret == 0, but in our case vfb is still NULL.

Fix this by assigning sensible error to ret.

Found by Linux Verification Center (linuxtesting.org) with SVACE

Signed-off-by: Nikolay Kuratov <kniv@yandex-team.ru>
Cc: stable@vger.kernel.org
Fixes: 810b3e1683d0 ("drm/vmwgfx: Support topology greater than texture size")
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241002122429.1981822-1-kniv@yandex-team.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:21:55 +01:00
Ville Syrjälä
ff586b4f24 drm/radeon: Fix encoder->possible_clones
commit 28127dba64d8ae1a0b737b973d6d029908599611 upstream.

Include the encoder itself in its possible_clones bitmask.
In the past nothing validated that drivers were populating
possible_clones correctly, but that changed in commit
74d2aacbe840 ("drm: Validate encoder->possible_clones").
Looks like radeon never got the memo and is still not
following the rules 100% correctly.

This results in some warnings during driver initialization:
Bogus possible_clones: [ENCODER:46:TV-46] possible_clones=0x4 (full encoder mask=0x7)
WARNING: CPU: 0 PID: 170 at drivers/gpu/drm/drm_mode_config.c:615 drm_mode_config_validate+0x113/0x39c
...

Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Fixes: 74d2aacbe840 ("drm: Validate encoder->possible_clones")
Reported-by: Erhard Furtner <erhard_f@mailbox.org>
Closes: https://lore.kernel.org/dri-devel/20241009000321.418e4294@yea/
Tested-by: Erhard Furtner <erhard_f@mailbox.org>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 3b6e7d40649c0d75572039aff9d0911864c689db)
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:21:55 +01:00
Yonatan Maman
0486357541 nouveau/dmem: Fix vulnerability in migrate_to_ram upon copy error
commit 835745a377a4519decd1a36d6b926e369b3033e2 upstream.

The `nouveau_dmem_copy_one` function ensures that the copy push command is
sent to the device firmware but does not track whether it was executed
successfully.

In the case of a copy error (e.g., firmware or hardware failure), the
copy push command will be sent via the firmware channel, and
`nouveau_dmem_copy_one` will likely report success, leading to the
`migrate_to_ram` function returning a dirty HIGH_USER page to the user.

This can result in a security vulnerability, as a HIGH_USER page that may
contain sensitive or corrupted data could be returned to the user.

To prevent this vulnerability, we allocate a zero page. Thus, in case of
an error, a non-dirty (zero) page will be returned to the user.

Fixes: 5be73b690875 ("drm/nouveau/dmem: device memory helpers for SVM")
Signed-off-by: Yonatan Maman <Ymaman@Nvidia.com>
Co-developed-by: Gal Shalom <GalShalom@Nvidia.com>
Signed-off-by: Gal Shalom <GalShalom@Nvidia.com>
Reviewed-by: Ben Skeggs <bskeggs@nvidia.com>
Cc: stable@vger.kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20241008115943.990286-3-ymaman@nvidia.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-11-23 23:21:53 +01:00