|
|
306fa1 |
autofs-5.1.4 - fix use after free in do_master_list_reset()
|
|
|
306fa1 |
|
|
|
306fa1 |
From: Ian Kent <raven@themaw.net>
|
|
|
306fa1 |
|
|
|
306fa1 |
Umm ... list_for_each() can't be used in do_master_list_reset() because
|
|
|
306fa1 |
the subject entry of the loop is removed for the list within the loop
|
|
|
306fa1 |
body. Therefore it can't be used to calculate the next pointer within a
|
|
|
306fa1 |
for (...) loop.
|
|
|
306fa1 |
|
|
|
306fa1 |
There is no list_for_each_safe() macro in the list.h of autofs so it
|
|
|
306fa1 |
needs to be done manually.
|
|
|
306fa1 |
|
|
|
306fa1 |
Signed-off-by: Ian Kent <raven@themaw.net>
|
|
|
306fa1 |
---
|
|
|
306fa1 |
CHANGELOG | 1 +
|
|
|
306fa1 |
daemon/automount.c | 8 ++++++--
|
|
|
306fa1 |
2 files changed, 7 insertions(+), 2 deletions(-)
|
|
|
306fa1 |
|
|
|
306fa1 |
diff --git a/CHANGELOG b/CHANGELOG
|
|
|
306fa1 |
index 4cb23f2..6cd3029 100644
|
|
|
306fa1 |
--- a/CHANGELOG
|
|
|
306fa1 |
+++ b/CHANGELOG
|
|
|
306fa1 |
@@ -289,6 +289,7 @@
|
|
|
306fa1 |
- fix open calls not using open_xxxx() calls.
|
|
|
306fa1 |
- move open_xxxx() functions to spawn.c.
|
|
|
306fa1 |
- serialize calls to open_xxxx() functions.
|
|
|
306fa1 |
+- fix use after free in do_master_list_reset().
|
|
|
306fa1 |
|
|
|
306fa1 |
25/07/2012 autofs-5.0.7
|
|
|
306fa1 |
=======================
|
|
|
306fa1 |
diff --git a/daemon/automount.c b/daemon/automount.c
|
|
|
306fa1 |
index d96cd35..1a61b90 100644
|
|
|
306fa1 |
--- a/daemon/automount.c
|
|
|
306fa1 |
+++ b/daemon/automount.c
|
|
|
306fa1 |
@@ -2075,14 +2075,18 @@ static void remove_empty_args(char **argv, int *argc)
|
|
|
306fa1 |
|
|
|
306fa1 |
static void do_master_list_reset(struct master *master)
|
|
|
306fa1 |
{
|
|
|
306fa1 |
- struct list_head *head, *p;
|
|
|
306fa1 |
+ struct list_head *head, *p, *n;
|
|
|
306fa1 |
|
|
|
306fa1 |
master_mutex_lock();
|
|
|
306fa1 |
|
|
|
306fa1 |
head = &master->mounts;
|
|
|
306fa1 |
- list_for_each(p, head) {
|
|
|
306fa1 |
+ n = head->next;
|
|
|
306fa1 |
+ while (n != head) {
|
|
|
306fa1 |
struct master_mapent *entry;
|
|
|
306fa1 |
|
|
|
306fa1 |
+ p = n;
|
|
|
306fa1 |
+ n = p->next;
|
|
|
306fa1 |
+
|
|
|
306fa1 |
entry = list_entry(p, struct master_mapent, list);
|
|
|
306fa1 |
|
|
|
306fa1 |
if (!list_empty(&entry->list))
|