Skip to content

Commit e53f7b5

Browse files
Dan Carpenteraxboe
authored andcommitted
io_uring/kbuf: Fix an NULL vs IS_ERR() bug in io_alloc_pbuf_ring()
The io_mem_alloc() function returns error pointers, not NULL. Update the check accordingly. Fixes: b10b73c ("io_uring/kbuf: recycle freed mapped buffer ring entries") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent f7b32e7 commit e53f7b5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

io_uring/kbuf.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,8 @@ static int io_alloc_pbuf_ring(struct io_ring_ctx *ctx,
636636
ibf = io_lookup_buf_free_entry(ctx, ring_size);
637637
if (!ibf) {
638638
ptr = io_mem_alloc(ring_size);
639-
if (!ptr)
640-
return -ENOMEM;
639+
if (IS_ERR(ptr))
640+
return PTR_ERR(ptr);
641641

642642
/* Allocate and store deferred free entry */
643643
ibf = kmalloc(sizeof(*ibf), GFP_KERNEL_ACCOUNT);

0 commit comments

Comments
 (0)