* [PATCH] ecryptfs: hold msg ctx list lock when cleaning daemon queue
@ 2026-06-28 3:37 Yichong Chen
2026-07-20 9:36 ` Yichong Chen
2026-07-21 7:28 ` Tyler Hicks
0 siblings, 2 replies; 3+ messages in thread
From: Yichong Chen @ 2026-06-28 3:37 UTC (permalink / raw)
To: Tyler Hicks
Cc: Kees Cook, Thorsten Blum, Andrew Morton, Michael Halcrow,
ecryptfs, linux-kernel, Yichong Chen
ecryptfs_exorcise_daemon() drops queued messages from a dying daemon
without holding ecryptfs_msg_ctx_lists_mux, but
ecryptfs_msg_ctx_alloc_to_free() requires that lock.
Take the list lock while moving the queued contexts back to the free
list to avoid racing with other global msg ctx list users.
Fixes: f66e883eb618 ("eCryptfs: integrate eCryptfs device handle into the module.")
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
---
fs/ecryptfs/messaging.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c
index 03c60f0850ca..ecdfd965b87e 100644
--- a/fs/ecryptfs/messaging.c
+++ b/fs/ecryptfs/messaging.c
@@ -166,6 +166,7 @@ int ecryptfs_exorcise_daemon(struct ecryptfs_daemon *daemon)
mutex_unlock(&daemon->mux);
goto out;
}
+ mutex_lock(&ecryptfs_msg_ctx_lists_mux);
list_for_each_entry_safe(msg_ctx, msg_ctx_tmp,
&daemon->msg_ctx_out_queue, daemon_out_list) {
list_del(&msg_ctx->daemon_out_list);
@@ -174,6 +175,7 @@ int ecryptfs_exorcise_daemon(struct ecryptfs_daemon *daemon)
"the out queue of a dying daemon\n", __func__);
ecryptfs_msg_ctx_alloc_to_free(msg_ctx);
}
+ mutex_unlock(&ecryptfs_msg_ctx_lists_mux);
hlist_del(&daemon->euid_chain);
mutex_unlock(&daemon->mux);
kfree_sensitive(daemon);
--
2.48.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ecryptfs: hold msg ctx list lock when cleaning daemon queue
2026-06-28 3:37 [PATCH] ecryptfs: hold msg ctx list lock when cleaning daemon queue Yichong Chen
@ 2026-07-20 9:36 ` Yichong Chen
2026-07-21 7:28 ` Tyler Hicks
1 sibling, 0 replies; 3+ messages in thread
From: Yichong Chen @ 2026-07-20 9:36 UTC (permalink / raw)
To: code
Cc: chenyichong, akpm, ecryptfs, kees, linux-kernel, mhalcrow,
thorsten.blum
Ping.
Could anyone take a look at this patch? It fixes a missing
ecryptfs_msg_ctx_lists_mux lock on an eCryptfs daemon cleanup path.
Thanks,
Yichong
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ecryptfs: hold msg ctx list lock when cleaning daemon queue
2026-06-28 3:37 [PATCH] ecryptfs: hold msg ctx list lock when cleaning daemon queue Yichong Chen
2026-07-20 9:36 ` Yichong Chen
@ 2026-07-21 7:28 ` Tyler Hicks
1 sibling, 0 replies; 3+ messages in thread
From: Tyler Hicks @ 2026-07-21 7:28 UTC (permalink / raw)
To: Yichong Chen
Cc: Kees Cook, Thorsten Blum, Andrew Morton, ecryptfs, linux-kernel
On Sun, 28 Jun 2026 11:37:25 +0800, Yichong Chen wrote:
> ecryptfs_exorcise_daemon() drops queued messages from a dying daemon
> without holding ecryptfs_msg_ctx_lists_mux, but
> ecryptfs_msg_ctx_alloc_to_free() requires that lock.
>
> Take the list lock while moving the queued contexts back to the free
> list to avoid racing with other global msg ctx list users.
>
> [...]
Thank you! This has been applied to the next branch of the tyhicks/ecryptfs.git tree.
You can find a direct link below but please be aware that the commit hash is
unstable and, therefore, the URL may not be valid in the future.
[1/1] ecryptfs: hold msg ctx list lock when cleaning daemon queue
https://git.kernel.org/tyhicks/ecryptfs/c/779972513c2fa8c7938e54976f686091dafff22f
Tyler
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-21 7:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-28 3:37 [PATCH] ecryptfs: hold msg ctx list lock when cleaning daemon queue Yichong Chen
2026-07-20 9:36 ` Yichong Chen
2026-07-21 7:28 ` Tyler Hicks
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox