[lxc-devel] [lxc/master] coverity: bugfixes
brauner on Github
lxc-bot at linuxcontainers.org
Thu Dec 7 14:04:18 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 364 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171207/d0a53abb/attachment.bin>
-------------- next part --------------
From e1e7642342dc296626b3c9f4906c0a60924f8477 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 7 Dec 2017 14:59:55 +0100
Subject: [PATCH 1/2] coverity: #1425929
free allocated memory
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/lxccontainer.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
index c97381b9f..791b21113 100644
--- a/src/lxc/lxccontainer.c
+++ b/src/lxc/lxccontainer.c
@@ -848,10 +848,12 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
/* ... otherwise use default_args. */
if (!argv) {
- if (useinit)
+ if (useinit) {
+ ERROR("No valid init detected");
+ lxc_free_handler(handler);
return false;
- else
- argv = default_args;
+ }
+ argv = default_args;
}
/* I'm not sure what locks we want here.Any? Is liblxc's locking enough
From 3ee9e4fb38745f29a4f69528429f5f3be63dfd79 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Thu, 7 Dec 2017 15:01:51 +0100
Subject: [PATCH 2/2] coverity: #1425928
Avoid NULL-pointer dereference. Apparently monitor.{c,h} calls
lxc_check_inherited() with NULL passed for the config. This isn't really a big
issue since monitor.{c,h} is effectively dead for all liblxc versions that have
the state client patch. Also, the patch that introduces the relevant lines into
lxc_check_inherited() is only in master and yet unreleased.
Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
src/lxc/start.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/lxc/start.c b/src/lxc/start.c
index 72e3f0146..b82768687 100644
--- a/src/lxc/start.c
+++ b/src/lxc/start.c
@@ -226,14 +226,16 @@ int lxc_check_inherited(struct lxc_conf *conf, bool closeall,
continue;
/* Keep state clients that wait on reboots. */
- lxc_list_for_each(cur, &conf->state_clients) {
- struct lxc_state_client *client = cur->elem;
+ if (conf) {
+ lxc_list_for_each(cur, &conf->state_clients) {
+ struct lxc_state_client *client = cur->elem;
- if (client->clientfd != fd)
- continue;
+ if (client->clientfd != fd)
+ continue;
- matched = true;
- break;
+ matched = true;
+ break;
+ }
}
if (matched)
More information about the lxc-devel
mailing list