From: Steven Galgano Date: Mon, 14 Oct 2024 19:16:36 +0000 (-0400) Subject: Avoid null pointer dereference when using shared rootfs. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F4488%2Fhead;p=thirdparty%2Flxc.git Avoid null pointer dereference when using shared rootfs. rootfs->storage not set by lxc_storage_prepare when using a shared rootfs. Fixes: https://github.com/lxc/lxc/issues/4476 Signed-off-by: Steven Galgano --- diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 4b46d24bf..6a14c6036 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -341,6 +341,10 @@ int lxc_rootfs_init(struct lxc_conf *conf, bool userns) ret = lxc_storage_prepare(conf); if (ret) return syserror_set(-EINVAL, "Failed to prepare rootfs storage"); + + if (!rootfs->storage) + return log_trace(0, "Not pinning because container does not have storage"); + type = rootfs->storage->type; if (!type)