public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: fix an IS_ERR() vs NULL check
@ 2021-01-06  9:26 Dan Carpenter
  2021-01-06 12:32 ` Pavel Begunkov
  2021-01-06 14:29 ` Jens Axboe
  0 siblings, 2 replies; 6+ messages in thread
From: Dan Carpenter @ 2021-01-06  9:26 UTC (permalink / raw)
  To: Pavel Begunkov, Jens Axboe
  Cc: Alexander Viro, io-uring, linux-fsdevel, kernel-janitors

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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-01-06 15:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-06  9:26 [PATCH] io_uring: fix an IS_ERR() vs NULL check Dan Carpenter
2021-01-06 12:32 ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox