Skip to content

Commit defc06f

Browse files
committed
Merge tag 'drm-misc-fixes-2024-11-28' of https://gitlab.freedesktop.org/drm/misc/kernel into drm-fixes
Short summary of fixes pull: dma-buf: - Fix dma_fence_array_signaled() to ensure forward progress dp_mst: - Fix MST sideband message body length check sti: - Add __iomem for mixer_dbg_mxn()'s parameter Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Zimmermann <tzimmermann@suse.de> Link: https://patchwork.freedesktop.org/patch/msgid/20241128135958.GA244627@linux.fritz.box
2 parents 8cc4d0f + 86e8f94 commit defc06f

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

drivers/dma-buf/dma-fence-array.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,36 @@ static bool dma_fence_array_enable_signaling(struct dma_fence *fence)
103103
static bool dma_fence_array_signaled(struct dma_fence *fence)
104104
{
105105
struct dma_fence_array *array = to_dma_fence_array(fence);
106+
int num_pending;
107+
unsigned int i;
106108

107-
if (atomic_read(&array->num_pending) > 0)
109+
/*
110+
* We need to read num_pending before checking the enable_signal bit
111+
* to avoid racing with the enable_signaling() implementation, which
112+
* might decrement the counter, and cause a partial check.
113+
* atomic_read_acquire() pairs with atomic_dec_and_test() in
114+
* dma_fence_array_enable_signaling()
115+
*
116+
* The !--num_pending check is here to account for the any_signaled case
117+
* if we race with enable_signaling(), that means the !num_pending check
118+
* in the is_signalling_enabled branch might be outdated (num_pending
119+
* might have been decremented), but that's fine. The user will get the
120+
* right value when testing again later.
121+
*/
122+
num_pending = atomic_read_acquire(&array->num_pending);
123+
if (test_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT, &array->base.flags)) {
124+
if (num_pending <= 0)
125+
goto signal;
108126
return false;
127+
}
128+
129+
for (i = 0; i < array->num_fences; ++i) {
130+
if (dma_fence_is_signaled(array->fences[i]) && !--num_pending)
131+
goto signal;
132+
}
133+
return false;
109134

135+
signal:
110136
dma_fence_array_clear_pending_error(array);
111137
return true;
112138
}

drivers/gpu/drm/display/drm_dp_mst_topology.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,9 @@ static bool drm_dp_decode_sideband_msg_hdr(const struct drm_dp_mst_topology_mgr
320320
hdr->broadcast = (buf[idx] >> 7) & 0x1;
321321
hdr->path_msg = (buf[idx] >> 6) & 0x1;
322322
hdr->msg_len = buf[idx] & 0x3f;
323+
if (hdr->msg_len < 1) /* min space for body CRC */
324+
return false;
325+
323326
idx++;
324327
hdr->somt = (buf[idx] >> 7) & 0x1;
325328
hdr->eomt = (buf[idx] >> 6) & 0x1;

drivers/gpu/drm/sti/sti_mixer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static void mixer_dbg_crb(struct seq_file *s, int val)
137137
}
138138
}
139139

140-
static void mixer_dbg_mxn(struct seq_file *s, void *addr)
140+
static void mixer_dbg_mxn(struct seq_file *s, void __iomem *addr)
141141
{
142142
int i;
143143

0 commit comments

Comments
 (0)