diff options
Diffstat (limited to 'io_uring/rsrc.c')
-rw-r--r-- | io_uring/rsrc.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c index 2d5d66e792ec..f75f5e43fa4a 100644 --- a/io_uring/rsrc.c +++ b/io_uring/rsrc.c @@ -138,8 +138,10 @@ static void io_free_imu(struct io_ring_ctx *ctx, struct io_mapped_ubuf *imu) static void io_buffer_unmap(struct io_ring_ctx *ctx, struct io_mapped_ubuf *imu) { - if (!refcount_dec_and_test(&imu->refs)) - return; + if (unlikely(refcount_read(&imu->refs) > 1)) { + if (!refcount_dec_and_test(&imu->refs)) + return; + } if (imu->acct_pages) io_unaccount_mem(ctx, imu->acct_pages); |