Dereference after null check

userns_exec_{1,full} are called from functions that might not have a conf.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2018-05-01 17:27:51 +02:00
parent 023e2a307a
commit 2b2655a8c5
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D
2 changed files with 7 additions and 0 deletions

View File

@ -4117,6 +4117,9 @@ int userns_exec_1(struct lxc_conf *conf, int (*fn)(void *), void *data,
int ret = -1, status = -1;
char c = '1';
if (!conf)
return -EINVAL;
idmap = get_minimal_idmap(conf);
if (!idmap)
return -1;
@ -4200,6 +4203,9 @@ int userns_exec_full(struct lxc_conf *conf, int (*fn)(void *), void *data,
struct id_map *container_root_uid = NULL, *container_root_gid = NULL,
*host_uid_map = NULL, *host_gid_map = NULL;
if (!conf)
return -EINVAL;
ret = pipe(p);
if (ret < 0) {
SYSERROR("opening pipe");

View File

@ -2955,6 +2955,7 @@ static bool do_lxcapi_destroy(struct lxc_container *c)
{
if (!c || !lxcapi_is_defined(c))
return false;
if (has_snapshots(c)) {
ERROR("Container %s has snapshots; not removing", c->name);
return false;