All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: [PATCH] io_uring: signedness bug in io_async_cancel()
Date: Thu, 31 Oct 2019 13:55:47 +0300	[thread overview]
Message-ID: <20191031105547.GC26612@mwanda> (raw)

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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index c4cdfe16cba7..9dcbde233657 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -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;
-- 
2.20.1


WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: [PATCH] io_uring: signedness bug in io_async_cancel()
Date: Thu, 31 Oct 2019 10:55:47 +0000	[thread overview]
Message-ID: <20191031105547.GC26612@mwanda> (raw)

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")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index c4cdfe16cba7..9dcbde233657 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -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;
-- 
2.20.1

             reply	other threads:[~2019-10-31 10:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-31 10:55 Dan Carpenter [this message]
2019-10-31 10:55 ` [PATCH] io_uring: signedness bug in io_async_cancel() Dan Carpenter
2019-10-31 12:57 ` Jens Axboe
2019-10-31 12:57   ` 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 \
    --in-reply-to=20191031105547.GC26612@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=axboe@kernel.dk \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.