From: Bernd Schubert <bschubert@ddn.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Joanne Koong <joannelkoong@gmail.com>,
linux-fsdevel@vger.kernel.org, Jian Huang Li <ali@ddn.com>,
Bernd Schubert <bschubert@ddn.com>
Subject: [PATCH 1/2] fuse: Move ring queues_refs decrement
Date: Tue, 21 Oct 2025 23:33:30 +0200 [thread overview]
Message-ID: <20251021-io-uring-fixes-cancel-mem-leak-v1-1-26b78b2c973c@ddn.com> (raw)
In-Reply-To: <20251021-io-uring-fixes-cancel-mem-leak-v1-0-26b78b2c973c@ddn.com>
This is just to avoid code dup with an upcoming commit.
Signed-off-by: Bernd Schubert <bschubert@ddn.com>
---
fs/fuse/dev_uring.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
index f6b12aebb8bbe7d255980593b75b5fb5af9c669e..e7c1095b83b11fe46080c24f539df17e70969e21 100644
--- a/fs/fuse/dev_uring.c
+++ b/fs/fuse/dev_uring.c
@@ -328,7 +328,7 @@ static void fuse_uring_entry_teardown(struct fuse_ring_ent *ent)
{
struct fuse_req *req;
struct io_uring_cmd *cmd;
-
+ ssize_t queue_refs;
struct fuse_ring_queue *queue = ent->queue;
spin_lock(&queue->lock);
@@ -356,15 +356,16 @@ static void fuse_uring_entry_teardown(struct fuse_ring_ent *ent)
if (req)
fuse_uring_stop_fuse_req_end(req);
+
+ queue_refs = atomic_dec_return(&queue->ring->queue_refs);
+ WARN_ON_ONCE(queue_refs < 0);
}
static void fuse_uring_stop_list_entries(struct list_head *head,
struct fuse_ring_queue *queue,
enum fuse_ring_req_state exp_state)
{
- struct fuse_ring *ring = queue->ring;
struct fuse_ring_ent *ent, *next;
- ssize_t queue_refs = SSIZE_MAX;
LIST_HEAD(to_teardown);
spin_lock(&queue->lock);
@@ -381,11 +382,8 @@ static void fuse_uring_stop_list_entries(struct list_head *head,
spin_unlock(&queue->lock);
/* no queue lock to avoid lock order issues */
- list_for_each_entry_safe(ent, next, &to_teardown, list) {
+ list_for_each_entry_safe(ent, next, &to_teardown, list)
fuse_uring_entry_teardown(ent);
- queue_refs = atomic_dec_return(&ring->queue_refs);
- WARN_ON_ONCE(queue_refs < 0);
- }
}
static void fuse_uring_teardown_entries(struct fuse_ring_queue *queue)
--
2.43.0
next prev parent reply other threads:[~2025-10-21 21:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 21:33 [PATCH 0/2] fuse: Fix possible memleak at startup with immediate teardown Bernd Schubert
2025-10-21 21:33 ` Bernd Schubert [this message]
2025-10-21 21:33 ` [PATCH 2/2] fs/fuse: fix potential memory leak from fuse_uring_cancel Bernd Schubert
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=20251021-io-uring-fixes-cancel-mem-leak-v1-1-26b78b2c973c@ddn.com \
--to=bschubert@ddn.com \
--cc=ali@ddn.com \
--cc=joannelkoong@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
/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;
as well as URLs for NNTP newsgroup(s).