summaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-08-22 23:41:28 +0300
committerTyler Hicks <tyhicks@canonical.com>2017-11-06 18:22:34 +0000
commitdb86be3a12d0b6e5c5b51c2ab2a48f06329cb590 (patch)
tree41c89d821f67a296b66a265a8ffcf04406f0db35 /fs/ecryptfs
parentabbae6d560c1d562c5c0d10785469734784ef961 (diff)
downloadlinux-stable-db86be3a12d0b6e5c5b51c2ab2a48f06329cb590.tar.gz
linux-stable-db86be3a12d0b6e5c5b51c2ab2a48f06329cb590.tar.bz2
linux-stable-db86be3a12d0b6e5c5b51c2ab2a48f06329cb590.zip
eCryptfs: use after free in ecryptfs_release_messaging()
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> Cc: <stable@vger.kernel.org> Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Diffstat (limited to 'fs/ecryptfs')
-rw-r--r--fs/ecryptfs/messaging.c7
1 files changed, 4 insertions, 3 deletions
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 "