• Hans Verkuil's avatar
    [media] Revert "[media] videobuf_vm_{open,close} race fixes" · cca36e2e
    Hans Verkuil authored
    This reverts commit a242f426.
    
    That commit actually caused deadlocks, rather then fixing them.
    
    If ext_lock is set to NULL (otherwise videobuf_queue_lock doesn't do
    anything), then you get this deadlock:
    
    The driver's mmap function calls videobuf_mmap_mapper which calls
    videobuf_queue_lock on q. videobuf_mmap_mapper calls  __videobuf_mmap_mapper,
    __videobuf_mmap_mapper calls videobuf_vm_open and videobuf_vm_open
    calls videobuf_queue_lock on q (introduced by above patch): deadlocked.
    
    This affects drivers using dma-contig and dma-vmalloc. Only dma-sg is
    not affected since it doesn't call videobuf_vm_open from __videobuf_mmap_mapper.
    
    Most drivers these days have a non-NULL ext_lock. Those that still use
    NULL there are all fairly obscure drivers, which is why this hasn't been
    seen earlier.
    
    Since everything worked perfectly fine for many years I prefer to just
    revert this patch rather than trying to fix it. videobuf...
    cca36e2e
videobuf-dma-contig.c 9.42 KB