mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-09-18 23:19:34 +02:00
ecryptfs: hold msg ctx list lock when cleaning daemon queue
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: f66e883eb6 ("eCryptfs: integrate eCryptfs device handle into the module.")
Cc: <stable@vger.kernel.org>
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
Signed-off-by: Tyler Hicks <code@tyhicks.com>
This commit is contained in:
committed by
Tyler Hicks
parent
219644a3ad
commit
779972513c
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user