|
|
aea863 |
autofs-5.1.4 - fix use after free in do_master_list_reset()
|
|
|
aea863 |
|
|
|
aea863 |
From: Ian Kent <raven@themaw.net>
|
|
|
aea863 |
|
|
|
aea863 |
Umm ... list_for_each() can't be used in do_master_list_reset() because
|
|
|
aea863 |
the subject entry of the loop is removed for the list within the loop
|
|
|
aea863 |
body. Therefore it can't be used to calculate the next pointer within a
|
|
|
aea863 |
for (...) loop.
|
|
|
aea863 |
|
|
|
aea863 |
There is no list_for_each_safe() macro in the list.h of autofs so it
|
|
|
aea863 |
needs to be done manually.
|
|
|
aea863 |
|
|
|
aea863 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
aea863 |
---
|
|
|
aea863 |
CHANGELOG | 1 +
|
|
|
aea863 |
daemon/automount.c | 8 ++++++--
|
|
|
aea863 |
2 files changed, 7 insertions(+), 2 deletions(-)
|
|
|
aea863 |
|
|
|
aea863 |
diff --git a/CHANGELOG b/CHANGELOG
|
|
|
aea863 |
index 4faab510..2747327b 100644
|
|
|
aea863 |
--- a/CHANGELOG
|
|
|
aea863 |
+++ b/CHANGELOG
|
|
|
aea863 |
@@ -1,6 +1,7 @@
|
|
|
aea863 |
xx/xx/2018 autofs-5.1.5
|
|
|
aea863 |
- fix flag file permission.
|
|
|
aea863 |
- fix directory create permission.
|
|
|
aea863 |
+- fix use after free in do_master_list_reset().
|
|
|
aea863 |
|
|
|
aea863 |
19/12/2017 autofs-5.1.4
|
|
|
aea863 |
- fix spec file url.
|
|
|
aea863 |
diff --git a/daemon/automount.c b/daemon/automount.c
|
|
|
aea863 |
index dcdc19fb..28b3f2f5 100644
|
|
|
aea863 |
--- a/daemon/automount.c
|
|
|
aea863 |
+++ b/daemon/automount.c
|
|
|
aea863 |
@@ -2070,14 +2070,18 @@ static void remove_empty_args(char **argv, int *argc)
|
|
|
aea863 |
|
|
|
aea863 |
static void do_master_list_reset(struct master *master)
|
|
|
aea863 |
{
|
|
|
aea863 |
- struct list_head *head, *p;
|
|
|
aea863 |
+ struct list_head *head, *p, *n;
|
|
|
aea863 |
|
|
|
aea863 |
master_mutex_lock();
|
|
|
aea863 |
|
|
|
aea863 |
head = &master->mounts;
|
|
|
aea863 |
- list_for_each(p, head) {
|
|
|
aea863 |
+ n = head->next;
|
|
|
aea863 |
+ while (n != head) {
|
|
|
aea863 |
struct master_mapent *entry;
|
|
|
aea863 |
|
|
|
aea863 |
+ p = n;
|
|
|
aea863 |
+ n = p->next;
|
|
|
aea863 |
+
|
|
|
aea863 |
entry = list_entry(p, struct master_mapent, list);
|
|
|
aea863 |
|
|
|
aea863 |
if (!list_empty(&entry->list))
|