* [PATCH] eCryptfs: use after free in ecryptfs_release_messaging()
@ 2017-08-22 20:41 Dan Carpenter
2017-10-14 1:24 ` Tyler Hicks
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-08-22 20:41 UTC (permalink / raw)
To: Tyler Hicks, Michael Halcrow; +Cc: ecryptfs, kernel-janitors
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 "
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] eCryptfs: use after free in ecryptfs_release_messaging()
2017-08-22 20:41 [PATCH] eCryptfs: use after free in ecryptfs_release_messaging() Dan Carpenter
@ 2017-10-14 1:24 ` Tyler Hicks
0 siblings, 0 replies; 2+ messages in thread
From: Tyler Hicks @ 2017-10-14 1:24 UTC (permalink / raw)
To: Dan Carpenter, Michael Halcrow; +Cc: ecryptfs, kernel-janitors
[-- 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 --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-14 1:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-22 20:41 [PATCH] eCryptfs: use after free in ecryptfs_release_messaging() Dan Carpenter
2017-10-14 1:24 ` Tyler Hicks
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox