Skip to content

Commit 5c34e65

Browse files
isilenceaxboe
authored andcommitted
io_uring/zcrx: don't clear not allocated niovs
Now that area->is_mapped is set earlier before niovs array is allocated, io_zcrx_free_area -> io_zcrx_unmap_area in an error path can try to clear dma addresses for unallocated niovs, fix it. Fixes: 8c0cab0 ("always dma map in advance") Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://patch.msgid.link/cbcb7749b5a001ecd4d1c303515ce9403215640c.1774780198.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 8ae2837 commit 5c34e65

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

io_uring/zcrx.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,8 +289,10 @@ static void io_zcrx_unmap_area(struct io_zcrx_ifq *ifq,
289289
return;
290290
area->is_mapped = false;
291291

292-
for (i = 0; i < area->nia.num_niovs; i++)
293-
net_mp_niov_set_dma_addr(&area->nia.niovs[i], 0);
292+
if (area->nia.niovs) {
293+
for (i = 0; i < area->nia.num_niovs; i++)
294+
net_mp_niov_set_dma_addr(&area->nia.niovs[i], 0);
295+
}
294296

295297
if (area->mem.is_dmabuf) {
296298
io_release_dmabuf(&area->mem);

0 commit comments

Comments
 (0)