[PATCH 1/2] dma-buf: add dma_fence_unwrap

Christian König ckoenig.leichtzumerken at gmail.com
Mon Mar 28 10:28:31 UTC 2022


Hi Ville & Daniel,

Am 25.03.22 um 16:28 schrieb Christian König:
> Am 25.03.22 um 16:25 schrieb Ville Syrjälä:
>> On Fri, Mar 11, 2022 at 12:02:43PM +0100, Christian König wrote:
>>> Add a general purpose helper to deep dive into 
>>> dma_fence_chain/dma_fence_array
>>> structures and iterate over all the fences in them.
>>>
>>> This is useful when we need to flatten out all fences in those 
>>> structures.
>>>
>>> Signed-off-by: Christian König <christian.koenig at amd.com>
>> One of the dma-buf patches took down Intel CI. Looks like every
>> machine oopses in some sync_file thing now:
>> <1>[  260.470008] BUG: kernel NULL pointer dereference, address: 
>> 0000000000000010
>> <1>[  260.470020] #PF: supervisor read access in kernel mode
>> <1>[  260.470025] #PF: error_code(0x0000) - not-present page
>> <6>[  260.470030] PGD 0 P4D 0
>> <4>[  260.470035] Oops: 0000 [#1] PREEMPT SMP NOPTI
>> <4>[  260.470040] CPU: 0 PID: 5306 Comm: core_hotunplug Not tainted 
>> 5.17.0-CI-CI_DRM_11405+ #1
>> <4>[  260.470049] Hardware name: Intel Corporation Jasper Lake Client 
>> Platform/Jasperlake DDR4 SODIMM RVP, BIOS 
>> JSLSFWI1.R00.2385.D02.2010160831 10/16/2020
>> <4>[  260.470058] RIP: 0010:dma_fence_array_first+0x19/0x20

I've looked into this and the root cause seems to be that the new code 
doesn't handle dma_fence_arrays with zero elements.

That is rather easy to fix, but a dma_fence_array with zero number of 
elements is most likely a bug because under the wrong circumstances it 
can create a dma_fence instance which will never signal.

I've send out a patch on Frinday ([PATCH] dma-buf: WIP 
dma_fence_array_first fix) which avoids the crash and prints a warning 
if anybody tries to create a dma_fence_array with zero length.

Can you test this?

Thanks in advance,
Christian.


More information about the dri-devel mailing list