mirror of
git://git.yoctoproject.org/meta-virtualization.git
synced 2025-07-19 12:50:22 +02:00
lxc: always strdup lxc.rootfs.mount
The reason is that the generic code which handles reading lxc.rootfs.mount always frees the old value if not NULL. So without this setting lxc.rootfs.mount = /mnt causes segfault. This is a backport for lxc-0.9.0 (dora) of the same fix found in upstream's master, see commits 54c30e29 and 53f3f048. Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
This commit is contained in:
parent
7e68875840
commit
7d7c38165c
|
@ -0,0 +1,27 @@
|
||||||
|
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
|
||||||
|
index 6b3f318..2f8b9e6 100644
|
||||||
|
--- a/src/lxc/conf.c
|
||||||
|
+++ b/src/lxc/conf.c
|
||||||
|
@@ -2072,7 +2072,12 @@ struct lxc_conf *lxc_conf_init(void)
|
||||||
|
new->console.slave = -1;
|
||||||
|
new->console.name[0] = '\0';
|
||||||
|
new->maincmd_fd = -1;
|
||||||
|
- new->rootfs.mount = default_rootfs_mount;
|
||||||
|
+ new->rootfs.mount = strdup(default_rootfs_mount);
|
||||||
|
+ if (!new->rootfs.mount) {
|
||||||
|
+ ERROR("lxc_conf_init : %m");
|
||||||
|
+ free(new);
|
||||||
|
+ return NULL;
|
||||||
|
+ }
|
||||||
|
new->kmsg = 1;
|
||||||
|
lxc_list_init(&new->cgroup);
|
||||||
|
lxc_list_init(&new->network);
|
||||||
|
@@ -3084,7 +3089,7 @@ void lxc_conf_free(struct lxc_conf *conf)
|
||||||
|
return;
|
||||||
|
if (conf->console.path)
|
||||||
|
free(conf->console.path);
|
||||||
|
- if (conf->rootfs.mount != default_rootfs_mount)
|
||||||
|
+ if (conf->rootfs.mount)
|
||||||
|
free(conf->rootfs.mount);
|
||||||
|
if (conf->rootfs.path)
|
||||||
|
free(conf->rootfs.path);
|
|
@ -26,6 +26,7 @@ SRC_URI = "http://linuxcontainers.org/downloads/${PN}-${PV}.tar.gz \
|
||||||
file://lxc-0.9.0-enable-chroot-chpasswd-functionality-for-busybox-hosts.patch \
|
file://lxc-0.9.0-enable-chroot-chpasswd-functionality-for-busybox-hosts.patch \
|
||||||
file://lxc-0.9.0-check-when-bind-mounting-libdirs.patch \
|
file://lxc-0.9.0-check-when-bind-mounting-libdirs.patch \
|
||||||
file://lxc-0.9.0-don-t-let-LXC_PATH-end-in-failure.patch \
|
file://lxc-0.9.0-don-t-let-LXC_PATH-end-in-failure.patch \
|
||||||
|
file://lxc-0.9.0-always-strdup-rootfs-mount.patch \
|
||||||
"
|
"
|
||||||
SRC_URI[md5sum] = "8552a4479090616f4bc04d8473765fc9"
|
SRC_URI[md5sum] = "8552a4479090616f4bc04d8473765fc9"
|
||||||
SRC_URI[sha256sum] = "1e1767eae6cc5fbf892c0e193d25da420ba19f2db203716c38f7cdea3b654120"
|
SRC_URI[sha256sum] = "1e1767eae6cc5fbf892c0e193d25da420ba19f2db203716c38f7cdea3b654120"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user