public inbox for [email protected]
 help / color / mirror / Atom feed
From: Dan Carpenter <[email protected]>
To: Pavel Begunkov <[email protected]>, Jens Axboe <[email protected]>
Cc: Alexander Viro <[email protected]>,
	[email protected], [email protected],
	[email protected]
Subject: [PATCH] io_uring: fix an IS_ERR() vs NULL check
Date: Wed, 6 Jan 2021 12:26:39 +0300	[thread overview]
Message-ID: <X/WCTxIRT4SHLemV@mwanda> (raw)

The alloc_fixed_file_ref_node() function never returns NULL, it returns
error pointers on error.

Fixes: 1ffc54220c44 ("io_uring: fix io_sqe_files_unregister() hangs")
Signed-off-by: Dan Carpenter <[email protected]>
---
 fs/io_uring.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index ca46f314640b..2234ce03034a 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -7255,8 +7255,8 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx)
 	if (!data)
 		return -ENXIO;
 	backup_node = alloc_fixed_file_ref_node(ctx);
-	if (!backup_node)
-		return -ENOMEM;
+	if (IS_ERR(backup_node))
+		return PTR_ERR(backup_node);
 
 	spin_lock_bh(&data->lock);
 	ref_node = data->node;
-- 
2.29.2


             reply	other threads:[~2021-01-06  9:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-06  9:26 Dan Carpenter [this message]
2021-01-06 12:32 ` [PATCH] io_uring: fix an IS_ERR() vs NULL check Pavel Begunkov
2021-01-06 14:34   ` Matthew Wilcox
2021-01-06 14:56     ` Dan Carpenter
2021-01-06 14:59       ` Jens Axboe
2021-01-06 14:29 ` 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=X/WCTxIRT4SHLemV@mwanda \
    [email protected] \
    [email protected] \
    [email protected] \
    [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