From: Dan Carpenter <dan.carpenter@oracle.com>
To: Tyler Hicks <tyhicks@canonical.com>,
Michael Halcrow <mhalcrow@us.ibm.com>
Cc: ecryptfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] eCryptfs: use after free in ecryptfs_release_messaging()
Date: Tue, 22 Aug 2017 23:41:28 +0300 [thread overview]
Message-ID: <20170822204128.7xhtrlpvueucbisl@mwanda> (raw)
We're freeing the list iterator so we should be using the _safe()
version of hlist_for_each_entry().
Fixes: 88b4a07e6610 ("[PATCH] eCryptfs: Public key transport mechanism")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
It's also possible that I misunderstood this code. Please review with
caution.
diff --git a/fs/ecryptfs/messaging.c b/fs/ecryptfs/messaging.c
index 286f10b0363b..4f457d5c4933 100644
--- a/fs/ecryptfs/messaging.c
+++ b/fs/ecryptfs/messaging.c
@@ -442,15 +442,16 @@ void ecryptfs_release_messaging(void)
}
if (ecryptfs_daemon_hash) {
struct ecryptfs_daemon *daemon;
+ struct hlist_node *n;
int i;
mutex_lock(&ecryptfs_daemon_hash_mux);
for (i = 0; i < (1 << ecryptfs_hash_bits); i++) {
int rc;
- hlist_for_each_entry(daemon,
- &ecryptfs_daemon_hash[i],
- euid_chain) {
+ hlist_for_each_entry_safe(daemon, n,
+ &ecryptfs_daemon_hash[i],
+ euid_chain) {
rc = ecryptfs_exorcise_daemon(daemon);
if (rc)
printk(KERN_ERR "%s: Error whilst "
next reply other threads:[~2017-08-22 20:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-22 20:41 Dan Carpenter [this message]
2017-10-14 1:24 ` [PATCH] eCryptfs: use after free in ecryptfs_release_messaging() Tyler Hicks
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=20170822204128.7xhtrlpvueucbisl@mwanda \
--to=dan.carpenter@oracle.com \
--cc=ecryptfs@vger.kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=mhalcrow@us.ibm.com \
--cc=tyhicks@canonical.com \
/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