From: Tyler Hicks <tyhicks@canonical.com>
To: Dan Carpenter <dan.carpenter@oracle.com>,
Michael Halcrow <mhalcrow@us.ibm.com>
Cc: ecryptfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] eCryptfs: use after free in ecryptfs_release_messaging()
Date: Fri, 13 Oct 2017 21:24:09 -0400 [thread overview]
Message-ID: <2e7b4c48-aea4-0951-1010-33380b2e6b73@canonical.com> (raw)
In-Reply-To: <20170822204128.7xhtrlpvueucbisl@mwanda>
[-- Attachment #1.1: Type: text/plain, Size: 1618 bytes --]
Hi Dan - Thanks for the patch. I'm sorry for not getting back to you
until now.
On 08/22/2017 04:41 PM, Dan Carpenter wrote:
> 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>
I think this patch is correct. I'll perform some testing and, if all
goes well, get it in before 4.14 is released.
Tyler
> ---
> 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 "
> --
> To unsubscribe from this list: send the line "unsubscribe ecryptfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
prev parent reply other threads:[~2017-10-14 1:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-22 20:41 [PATCH] eCryptfs: use after free in ecryptfs_release_messaging() Dan Carpenter
2017-10-14 1:24 ` Tyler Hicks [this message]
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=2e7b4c48-aea4-0951-1010-33380b2e6b73@canonical.com \
--to=tyhicks@canonical.com \
--cc=dan.carpenter@oracle.com \
--cc=ecryptfs@vger.kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=mhalcrow@us.ibm.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