From: Jens Axboe <[email protected]>
To: io-uring <[email protected]>
Cc: Matthew Wilcox <[email protected]>
Subject: [PATCH] io_uring: fix xa_alloc_cycle() error return value check
Date: Fri, 20 Aug 2021 14:57:57 -0600 [thread overview]
Message-ID: <[email protected]> (raw)
We currently check for ret != 0 to indicate error, but '1' is a valid
return and just indicates that the allocation succeeded with a wrap.
Correct the check to be for < 0, like it was before the xarray
conversion.
Cc: [email protected]
Fixes: 61cf93700fe6 ("io_uring: Convert personality_idr to XArray")
Signed-off-by: Jens Axboe <[email protected]>
---
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 979941bcd15a..60851908ed6f 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -9843,7 +9843,7 @@ static int io_register_personality(struct io_ring_ctx *ctx)
ret = xa_alloc_cyclic(&ctx->personalities, &id, (void *)creds,
XA_LIMIT(0, USHRT_MAX), &ctx->pers_next, GFP_KERNEL);
- if (!ret)
+ if (ret < 0)
return id;
put_cred(creds);
return ret;
--
Jens Axboe
next reply other threads:[~2021-08-20 20:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-20 20:57 Jens Axboe [this message]
2021-08-20 21:01 ` [PATCH] io_uring: fix xa_alloc_cycle() error return value check Jens Axboe
2021-08-20 21:49 ` Matthew Wilcox
2021-08-20 22:05 ` Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox