diff options
author | Harald Hoyer <harald@redhat.com> | 2015-06-09 10:31:14 +0200 |
---|---|---|
committer | Harald Hoyer <harald@redhat.com> | 2015-06-09 10:31:14 +0200 |
commit | f871aeed8bc45158f9e63d06153a236eb9376fd7 (patch) | |
tree | 603f54d4651dc210a352a250535e8a699f41a5e2 /src/shared | |
parent | fba3d902b49e1f4654b36c9d4311def4a084c3a7 (diff) | |
download | systemd-f871aeed8bc45158f9e63d06153a236eb9376fd7.tar.gz systemd-f871aeed8bc45158f9e63d06153a236eb9376fd7.tar.bz2 systemd-f871aeed8bc45158f9e63d06153a236eb9376fd7.zip |
Revert "util:bind_remount_recursive() fix "use after free""
This reverts commit 46be6129d3e52556eb0f2ae4d07818f9f3f7af7a.
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/util.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/shared/util.c b/src/shared/util.c index 1442301cd7..311acbb349 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -4931,15 +4931,11 @@ int bind_remount_recursive(const char *prefix, bool ro) { while ((x = set_steal_first(todo))) { - r = set_put(done, x); - if (r == -EEXIST) { - free(x); + r = set_consume(done, x); + if (r == -EEXIST) continue; - } - if (r < 0) { - free(x); + if (r < 0) return r; - } /* Try to reuse the original flag set, but * don't care for errors, in case of @@ -4949,15 +4945,14 @@ int bind_remount_recursive(const char *prefix, bool ro) { orig_flags &= ~MS_RDONLY; if (mount(NULL, x, NULL, orig_flags|MS_BIND|MS_REMOUNT|(ro ? MS_RDONLY : 0), NULL) < 0) { + /* Deal with mount points that are * obstructed by a later mount */ - if (errno != ENOENT) { - free(x); + if (errno != ENOENT) return -errno; - } } - free(x); + } } } |