summaryrefslogtreecommitdiff
path: root/src/core/mount.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-10-16 19:50:26 +0200
committerLennart Poettering <lennart@poettering.net>2012-10-16 19:50:26 +0200
commitb87705cdd2f791f8520edb78791d3e6f78afd481 (patch)
treed848be1753e3ac2537d9183a751396d4e6837200 /src/core/mount.c
parent770858811930c0658b189d980159ea1ac5663467 (diff)
mount: don't try to initialize extra deps for mount units before initializing their basic fields
Under some circumstances this could lead to a segfault since we we half-initialized a mount unit, then tried to hook it into the network of things and while doing that recursively ended up looking at our half-initialized mount unit again assuming it was fully initialized.
Diffstat (limited to 'src/core/mount.c')
-rw-r--r--src/core/mount.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/core/mount.c b/src/core/mount.c
index 3e40e3fc7b..e1c240e31b 100644
--- a/src/core/mount.c
+++ b/src/core/mount.c
@@ -1408,6 +1408,7 @@ static int mount_add_one(
bool delete;
char *e, *w = NULL, *o = NULL, *f = NULL;
MountParameters *p;
+ bool load_extras = false;
assert(m);
assert(what);
@@ -1461,9 +1462,10 @@ static int mount_add_one(
if (u->load_state == UNIT_ERROR) {
u->load_state = UNIT_LOADED;
u->load_error = 0;
- r = mount_add_extras(MOUNT(u));
- if (r < 0)
- goto fail;
+
+ /* Load in the extras later on, after we
+ * finished initialization of the unit */
+ load_extras = true;
}
}
@@ -1494,6 +1496,12 @@ static int mount_add_one(
p->passno = passno;
+ if (load_extras) {
+ r = mount_add_extras(MOUNT(u));
+ if (r < 0)
+ goto fail;
+ }
+
unit_add_to_dbus_queue(u);
return 0;