From: Valerie Aurora <val@versity.com>
To: rpdfs-devel@lists.linux.dev
Cc: Valerie Aurora <val@versity.com>
Subject: [PATCH 2/3] rpdfs: Initialize block seqlock before using it and fix memleak
Date: Thu, 19 Mar 2026 10:37:26 +0100 [thread overview]
Message-ID: <20260319093727.15343-3-val@versity.com> (raw)
In-Reply-To: <20260319093727.15343-1-val@versity.com>
alloc_data_page() was using bk->seqlock before it was
initialized. Move the lock initializations to before the
alloc_data_page() call and free the block struct if it fails.
Signed-off-by: Valerie Aurora <val@versity.com>
---
fs/rpdfs/block.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/fs/rpdfs/block.c b/fs/rpdfs/block.c
index b614d13f4a2b..825098c0de75 100644
--- a/fs/rpdfs/block.c
+++ b/fs/rpdfs/block.c
@@ -322,19 +322,20 @@ static struct rpdfs_block *alloc_block(bool with_page, gfp_t gfp)
goto out;
}
+ INIT_LIST_HEAD(&bk->lru_head);
+ atomic64_set(&bk->refcount, 0);
+ seqlock_init(&bk->seqlock);
+ init_waitqueue_head(&bk->waitq);
+ INIT_LIST_HEAD(&bk->dirty_head);
+
if (with_page) {
ret = alloc_data_page(bk, gfp);
if (ret < 0) {
+ kfree(bk);
bk = ERR_PTR(ret);
goto out;
}
}
-
- INIT_LIST_HEAD(&bk->lru_head);
- atomic64_set(&bk->refcount, 0);
- seqlock_init(&bk->seqlock);
- init_waitqueue_head(&bk->waitq);
- INIT_LIST_HEAD(&bk->dirty_head);
out:
return bk;
}
--
2.49.0
next prev parent reply other threads:[~2026-03-19 9:37 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 9:37 [PATCH 0/3] Minor locking fixes and debug output Valerie Aurora
2026-03-19 9:37 ` [PATCH 1/3] rpdfs: Use write_seqlock_bh() for balloc info Valerie Aurora
2026-03-25 22:05 ` Zach Brown
2026-03-19 9:37 ` Valerie Aurora [this message]
2026-03-25 22:08 ` [PATCH 2/3] rpdfs: Initialize block seqlock before using it and fix memleak Zach Brown
2026-03-19 9:37 ` [PATCH 3/3] rpdfs: Add debugging for block not found case in rpdfs_use_txn_prepared Valerie Aurora
2026-03-25 22:09 ` Zach Brown
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=20260319093727.15343-3-val@versity.com \
--to=val@versity.com \
--cc=rpdfs-devel@lists.linux.dev \
/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.