On 9/21/26 14:53, [email protected] wrote: ...>> }
[ ... ]+int dma_buf_io_init_map(struct dma_buf_io_ctx *ctx, struct dma_buf_io_map *map, + struct sg_table *sgt) +{ + unsigned seg_shift = ~0U; + struct scatterlist *sg; + unsigned long tmp; + int ret; + + for_each_sgtable_dma_sg(sgt, sg, tmp) + seg_shift = min(seg_shift, __ffs(sg_dma_len(sg))); + + ret = percpu_ref_init(&map->refs, dma_buf_io_map_refs_release, 0, + GFP_KERNEL);[Severity: High] Does this GFP_KERNEL allocation violate DMA-buf locking rules? dma_buf_io_create_map() calls ctx->dev_ops->map(ctx) while holding the dmabuf->resv ww_mutex. If the driver then calls dma_buf_io_init_map() under this lock, the GFP_KERNEL allocation could deadlock if memory reclaim attempts to acquire dma_resv locks.
Most of these look trivial, going to fix them. This one, however, doesn't sound true AFAIU, I haven't heard about any blank ban on GFP_KERNEL allocation under resv lock. -- Pavel Begunkov
