mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
io_uring/kbuf: check for buffer list readiness after NULL check
[ Upstream commit9865346b7e
] Move the buffer list 'is_ready' check below the validity check for the buffer list for a given group. Fixes:5cf4f52e6d
("io_uring: free io_buffer_list entries via RCU") Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
b2173a8b64
commit
7e6621b99d
@ -743,6 +743,8 @@ void *io_pbuf_get_address(struct io_ring_ctx *ctx, unsigned long bgid)
|
||||
|
||||
bl = __io_buffer_get_list(ctx, smp_load_acquire(&ctx->io_bl), bgid);
|
||||
|
||||
if (!bl || !bl->is_mmap)
|
||||
return NULL;
|
||||
/*
|
||||
* Ensure the list is fully setup. Only strictly needed for RCU lookup
|
||||
* via mmap, and in that case only for the array indexed groups. For
|
||||
@ -750,8 +752,6 @@ void *io_pbuf_get_address(struct io_ring_ctx *ctx, unsigned long bgid)
|
||||
*/
|
||||
if (!smp_load_acquire(&bl->is_ready))
|
||||
return NULL;
|
||||
if (!bl || !bl->is_mmap)
|
||||
return NULL;
|
||||
|
||||
return bl->buf_ring;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user