IO-Uring Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH][next] io_uring: fix flags check for the REQ_F_WORK_INITIALIZED setting
@ 2020-10-15 11:55 Colin King
  2020-10-15 13:12 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2020-10-15 11:55 UTC (permalink / raw)
  To: Alexander Viro, Jens Axboe, Pavel Begunkov, linux-fsdevel, io-uring
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently the check for REQ_F_WORK_INITIALIZED is always true because
the | operator is being used. I believe this check should be checking
if the bit is set using the & operator.

Addresses-Coverity: ("Wrong operator used")
Fixes: 9c357fed168a ("io_uring: fix REQ_F_COMP_LOCKED by killing it")
Signed-off-by: Colin Ian King <colin.king@canonical.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 01d0b35415dc..5ef54df03d7c 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1813,7 +1813,7 @@ static void __io_fail_links(struct io_kiocb *req)
 		 * but avoid REQ_F_WORK_INITIALIZED because it may deadlock on
 		 * work.fs->lock.
 		 */
-		if (link->flags | REQ_F_WORK_INITIALIZED)
+		if (link->flags & REQ_F_WORK_INITIALIZED)
 			io_put_req_deferred(link, 2);
 		else
 			io_double_put_req(link);
-- 
2.27.0


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

* Re: [PATCH][next] io_uring: fix flags check for the REQ_F_WORK_INITIALIZED setting
  2020-10-15 11:55 [PATCH][next] io_uring: fix flags check for the REQ_F_WORK_INITIALIZED setting Colin King
@ 2020-10-15 13:12 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-10-15 13:12 UTC (permalink / raw)
  To: Colin King, Alexander Viro, Pavel Begunkov, linux-fsdevel, io-uring
  Cc: kernel-janitors, linux-kernel

On 10/15/20 5:55 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently the check for REQ_F_WORK_INITIALIZED is always true because
> the | operator is being used. I believe this check should be checking
> if the bit is set using the & operator.

It should - I folded in the incremental from Pavel. This just meant that
we took the slow and safe path, but it obviously should be an AND here.

-- 
Jens Axboe


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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15 11:55 [PATCH][next] io_uring: fix flags check for the REQ_F_WORK_INITIALIZED setting Colin King
2020-10-15 13:12 ` Jens Axboe

IO-Uring Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/io-uring/0 io-uring/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 io-uring io-uring/ https://lore.kernel.org/io-uring \
		io-uring@vger.kernel.org
	public-inbox-index io-uring

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.io-uring


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git