Skip to contentSkip to conversation

io_uring: signedness bug in io_async_cancel()

PATCH In review Dan Carpenter 2 participants 2 messages Oct 31, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 io_uring: signedness bug in io_async_cancel()

The problem is that this enum is unsigned, and we do use "ret" for the enum values, but we also use it for negative error codes. If it's not signed then it causes a problem in the error handling.

Fixes 6ec62e598211 ("io_uring: support for generic async request cancel")
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/io_uring.c +1 -1
index c4cdfe16cba7..9dcbde233657 100644
@@ -2144,8 +2144,8 @@ static int io_async_cancel(struct io_kiocb *req, const struct io_uring_sqe *sqe,
 			   struct io_kiocb **nxt)
 {
 	struct io_ring_ctx *ctx = req->ctx;
-	enum io_wq_cancel ret;
 	void *sqe_addr;
+	int ret;
 
 	if (unlikely(ctx->flags & IORING_SETUP_IOPOLL))
 		return -EINVAL;
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 3 lines · Dan Carpenter

The problem is that this enum is unsigned, and we do use "ret" for the enum values, but we also use it for negative error codes. If it's not signed then it causes a problem in the error handling.

I noticed this one the other day, merged in a fix for it then. Not an issue in the current tree, though linux-next may still have the older one.

Signature · 1 line
Jens Axboe