summaryrefslogtreecommitdiff
path: root/mm/mmap_lock.c
diff options
context:
space:
mode:
authorT.J. Mercier <tjmercier@google.com>2025-12-03 16:03:47 -0800
committerAlexei Starovoitov <ast@kernel.org>2025-12-09 23:48:34 -0800
commit234483565dbb2b264fdd165927c89fbf3ecf4733 (patch)
treeb121255437d87083eafa9edbd3a5ef2424eb27b5 /mm/mmap_lock.c
parent297c3fba9d766b52b6b8e99fa53f0a85c5902909 (diff)
bpf: Fix truncated dmabuf iterator reads
If there is a large number (hundreds) of dmabufs allocated, the text output generated from dmabuf_iter_seq_show can exceed common user buffer sizes (e.g. PAGE_SIZE) necessitating multiple start/stop cycles to iterate through all dmabufs. However the dmabuf iterator currently returns NULL in dmabuf_iter_seq_start for all non-zero pos values, which results in the truncation of the output before all dmabufs are handled. After dma_buf_iter_begin / dma_buf_iter_next, the refcount of the buffer is elevated so that the BPF iterator program can run without holding any locks. When a stop occurs, instead of immediately dropping the reference on the buffer, stash a pointer to the buffer in seq->priv until either start is called or the iterator is released. This also enables the resumption of iteration without first walking through the list of dmabufs based on the pos value. Fixes: 76ea95534995 ("bpf: Add dmabuf iterator") Signed-off-by: T.J. Mercier <tjmercier@google.com> Link: https://lore.kernel.org/r/20251204000348.1413593-1-tjmercier@google.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'mm/mmap_lock.c')
0 files changed, 0 insertions, 0 deletions