diff options
| author | Pavel Begunkov <asml.silence@gmail.com> | 2026-05-19 12:44:28 +0100 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2026-05-26 10:42:01 -0600 |
| commit | e57b44039bc54bbdf3d1511021458356858a4a12 (patch) | |
| tree | 9992b3f4230aec24e4bb2689b072d74e61c7085e /io_uring | |
| parent | 74fc9a9b50d43ed473ea2449682000da43e17175 (diff) | |
io_uring/zcrx: poison pointers on unregistration
Nobody should be touching area and other pointers after zcrx
destruction, poison them instead of zeroing.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://patch.msgid.link/19112d1412539dcfc04a0317b5812e968623bc51.1779189667.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring')
| -rw-r--r-- | io_uring/zcrx.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c index a7eef37868cf..4a1aea317287 100644 --- a/io_uring/zcrx.c +++ b/io_uring/zcrx.c @@ -245,14 +245,13 @@ static void io_release_area_mem(struct io_zcrx_mem *mem) { if (mem->is_dmabuf) { io_release_dmabuf(mem); - return; - } - if (mem->pages) { + } else if (mem->pages) { unpin_user_pages(mem->pages, mem->nr_folios); sg_free_table(mem->sgt); - mem->sgt = NULL; kvfree(mem->pages); } + mem->pages = IO_URING_PTR_POISON; + mem->sgt = IO_URING_PTR_POISON; } static int io_import_area(struct io_zcrx_ifq *ifq, @@ -403,8 +402,8 @@ static int io_allocate_rbuf_ring(struct io_ring_ctx *ctx, static void io_free_rbuf_ring(struct io_zcrx_ifq *ifq) { io_free_region(ifq->user, &ifq->rq_region); - ifq->rq.ring = NULL; - ifq->rq.rqes = NULL; + ifq->rq.ring = IO_URING_PTR_POISON; + ifq->rq.rqes = IO_URING_PTR_POISON; } static void io_zcrx_free_area(struct io_zcrx_ifq *ifq, |
