Re: [PATCH v4 1/3] drm/sched: cache the timeline name to fix a use-after-free

From: Christian König

Date: Mon Sep 07 2026 - 09:07:48 EST


On 9/7/26 13:15, Philipp Stanner wrote:
> On Mon, 2026-09-07 at 12:06 +0100, Tvrtko Ursulin wrote:
>> On 07/09/2026 11:47, Philipp Stanner wrote:
>
> […]
>
>>>
>>> So I maintain the position that we only get it right by having the
>>> signaled-bit be the decoupling point.
>>>
>>> Or am I missing something?
>>
>> The driver fixes you asked about and I listed work(ed) in the context of
>> 506aa8b02a8d ("dma-fence: Add safe access helpers and document the
>> rules"). In that "world" it would have been safe. Did 035219a760ed
>> ("dma-buf: dma-fence: Fix potential NULL pointer dereference") break
>> those fixes a bit?
>
> I think we all agree that 035219a760ed should not have been implemented
> in that way because it does not work for drivers that provide a ops-
>> release / ops->wait.
>
> So I think the only thing we can do right now is add the signaled-check
> back (like Christian suggested) and ensure correct memory ordering –
> since we also cannot use the spinlock consistently, as that can still
> be extern…

I think the memory ordering isn't really a problem.

See if the ops pointer or the signaled bit is loaded first doesn't matter if you check both.

You only need to make sure that the ops pointer is loaded once cause that one is used multiple times, but that is already the case by using rcu_dereference().

Or what exactly is your concern?

Thanks,
Christian.

>
>
> P.