Skip to content

Commit aec3e2e

Browse files
committed
Merge tag 'drm-misc-fixes-2023-11-08' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
drm-misc-fixes for v6.7-rc1: qxl: - qxl memory leak fix. syncobj: - Fix waiting for DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE vc4: - Fix UAF in mock helpers Signed-off-by: Daniel Vetter <[email protected]> From: Maarten Lankhorst <[email protected]> [sima: Stitch together both changelogs from Maarten. Also because of branch history this contains a few more bugfixes which are already in v6.6, but I didn't feel like this justifies some backmerge since there wasn't any real conflict.] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2 parents 0b336ec + 0e8b9f2 commit aec3e2e

File tree

10 files changed

+28
-21
lines changed

10 files changed

+28
-21
lines changed

drivers/accel/ivpu/ivpu_hw_37xx.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -906,9 +906,6 @@ static u32 ivpu_hw_37xx_irqb_handler(struct ivpu_device *vdev, int irq)
906906
if (status == 0)
907907
return 0;
908908

909-
/* Disable global interrupt before handling local buttress interrupts */
910-
REGB_WR32(VPU_37XX_BUTTRESS_GLOBAL_INT_MASK, 0x1);
911-
912909
if (REG_TEST_FLD(VPU_37XX_BUTTRESS_INTERRUPT_STAT, FREQ_CHANGE, status))
913910
ivpu_dbg(vdev, IRQ, "FREQ_CHANGE irq: %08x",
914911
REGB_RD32(VPU_37XX_BUTTRESS_CURRENT_PLL));
@@ -940,9 +937,6 @@ static u32 ivpu_hw_37xx_irqb_handler(struct ivpu_device *vdev, int irq)
940937
else
941938
REGB_WR32(VPU_37XX_BUTTRESS_INTERRUPT_STAT, status);
942939

943-
/* Re-enable global interrupt */
944-
REGB_WR32(VPU_37XX_BUTTRESS_GLOBAL_INT_MASK, 0x0);
945-
946940
if (schedule_recovery)
947941
ivpu_pm_schedule_recovery(vdev);
948942

@@ -954,9 +948,14 @@ static irqreturn_t ivpu_hw_37xx_irq_handler(int irq, void *ptr)
954948
struct ivpu_device *vdev = ptr;
955949
u32 ret_irqv, ret_irqb;
956950

951+
REGB_WR32(VPU_37XX_BUTTRESS_GLOBAL_INT_MASK, 0x1);
952+
957953
ret_irqv = ivpu_hw_37xx_irqv_handler(vdev, irq);
958954
ret_irqb = ivpu_hw_37xx_irqb_handler(vdev, irq);
959955

956+
/* Re-enable global interrupts to re-trigger MSI for pending interrupts */
957+
REGB_WR32(VPU_37XX_BUTTRESS_GLOBAL_INT_MASK, 0x0);
958+
960959
return IRQ_RETVAL(ret_irqb | ret_irqv);
961960
}
962961

drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@ static int reserve_bo_and_vm(struct kgd_mem *mem,
11441144
if (unlikely(ret))
11451145
goto error;
11461146

1147-
ret = drm_exec_lock_obj(&ctx->exec, &bo->tbo.base);
1147+
ret = drm_exec_prepare_obj(&ctx->exec, &bo->tbo.base, 1);
11481148
drm_exec_retry_on_contention(&ctx->exec);
11491149
if (unlikely(ret))
11501150
goto error;

drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ static int amdgpu_cs_parser_init(struct amdgpu_cs_parser *p,
6565
}
6666

6767
amdgpu_sync_create(&p->sync);
68-
drm_exec_init(&p->exec, DRM_EXEC_INTERRUPTIBLE_WAIT);
68+
drm_exec_init(&p->exec, DRM_EXEC_INTERRUPTIBLE_WAIT |
69+
DRM_EXEC_IGNORE_DUPLICATES);
6970
return 0;
7071
}
7172

drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ bool amdgpu_ctx_priority_is_valid(int32_t ctx_prio)
5656
return true;
5757
default:
5858
case AMDGPU_CTX_PRIORITY_UNSET:
59+
/* UNSET priority is not valid and we don't carry that
60+
* around, but set it to NORMAL in the only place this
61+
* function is called, amdgpu_ctx_ioctl().
62+
*/
5963
return false;
6064
}
6165
}
@@ -96,9 +100,6 @@ amdgpu_ctx_to_drm_sched_prio(int32_t ctx_prio)
96100
static int amdgpu_ctx_priority_permit(struct drm_file *filp,
97101
int32_t priority)
98102
{
99-
if (!amdgpu_ctx_priority_is_valid(priority))
100-
return -EINVAL;
101-
102103
/* NORMAL and below are accessible by everyone */
103104
if (priority <= AMDGPU_CTX_PRIORITY_NORMAL)
104105
return 0;
@@ -633,8 +634,6 @@ static int amdgpu_ctx_query2(struct amdgpu_device *adev,
633634
return 0;
634635
}
635636

636-
637-
638637
static int amdgpu_ctx_stable_pstate(struct amdgpu_device *adev,
639638
struct amdgpu_fpriv *fpriv, uint32_t id,
640639
bool set, u32 *stable_pstate)
@@ -677,8 +676,10 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data,
677676
id = args->in.ctx_id;
678677
priority = args->in.priority;
679678

680-
/* For backwards compatibility reasons, we need to accept
681-
* ioctls with garbage in the priority field */
679+
/* For backwards compatibility, we need to accept ioctls with garbage
680+
* in the priority field. Garbage values in the priority field, result
681+
* in the priority being set to NORMAL.
682+
*/
682683
if (!amdgpu_ctx_priority_is_valid(priority))
683684
priority = AMDGPU_CTX_PRIORITY_NORMAL;
684685

drivers/gpu/drm/display/drm_dp_mst_topology.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2574,14 +2574,14 @@ static struct drm_dp_mst_branch *get_mst_branch_device_by_guid_helper(
25742574
struct drm_dp_mst_branch *found_mstb;
25752575
struct drm_dp_mst_port *port;
25762576

2577+
if (!mstb)
2578+
return NULL;
2579+
25772580
if (memcmp(mstb->guid, guid, 16) == 0)
25782581
return mstb;
25792582

25802583

25812584
list_for_each_entry(port, &mstb->ports, next) {
2582-
if (!port->mstb)
2583-
continue;
2584-
25852585
found_mstb = get_mst_branch_device_by_guid_helper(port->mstb, guid);
25862586

25872587
if (found_mstb)

drivers/gpu/drm/drm_syncobj.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,8 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,
10691069
fence = drm_syncobj_fence_get(syncobjs[i]);
10701070
if (!fence || dma_fence_chain_find_seqno(&fence, points[i])) {
10711071
dma_fence_put(fence);
1072-
if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) {
1072+
if (flags & (DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT |
1073+
DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE)) {
10731074
continue;
10741075
} else {
10751076
timeout = -EINVAL;

drivers/gpu/drm/logicvc/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ config DRM_LOGICVC
55
select DRM_KMS_HELPER
66
select DRM_KMS_DMA_HELPER
77
select DRM_GEM_DMA_HELPER
8+
select REGMAP
9+
select REGMAP_MMIO
810
help
911
DRM display driver for the logiCVC programmable logic block from Xylon

drivers/gpu/drm/qxl/qxl_display.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,6 +1229,9 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev)
12291229
if (!qdev->monitors_config_bo)
12301230
return 0;
12311231

1232+
kfree(qdev->dumb_heads);
1233+
qdev->dumb_heads = NULL;
1234+
12321235
qdev->monitors_config = NULL;
12331236
qdev->ram_header->monitors_config = 0;
12341237

drivers/gpu/drm/vc4/tests/vc4_mock_crtc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ struct vc4_dummy_crtc *vc4_mock_pv(struct kunit *test,
2626
struct vc4_crtc *vc4_crtc;
2727
int ret;
2828

29-
dummy_crtc = kunit_kzalloc(test, sizeof(*dummy_crtc), GFP_KERNEL);
29+
dummy_crtc = drmm_kzalloc(drm, sizeof(*dummy_crtc), GFP_KERNEL);
3030
KUNIT_ASSERT_NOT_NULL(test, dummy_crtc);
3131

3232
vc4_crtc = &dummy_crtc->crtc;

drivers/gpu/drm/vc4/tests/vc4_mock_output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct vc4_dummy_output *vc4_dummy_output(struct kunit *test,
3232
struct drm_encoder *enc;
3333
int ret;
3434

35-
dummy_output = kunit_kzalloc(test, sizeof(*dummy_output), GFP_KERNEL);
35+
dummy_output = drmm_kzalloc(drm, sizeof(*dummy_output), GFP_KERNEL);
3636
KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dummy_output);
3737
dummy_output->encoder.type = vc4_encoder_type;
3838

0 commit comments

Comments
 (0)