From 8062e643e62387895ea9c3243aeca7c7a894fcd1 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 27 Aug 2020 13:49:21 +0900 Subject: [PATCH 1/2] core: clear bind mounts on error Follow-up for bbb4e7f39f2c68c719c26c2c65f8b7b91b009e92. Fixes CID#1431998. --- src/core/execute.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/execute.c b/src/core/execute.c index 444c3985f1..1680fc72a2 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -3127,8 +3127,10 @@ static int apply_mount_namespace( if (exec_context_has_credentials(context) && params->prefix[EXEC_DIRECTORY_RUNTIME]) { creds_path = path_join(params->prefix[EXEC_DIRECTORY_RUNTIME], "credentials", u->id); - if (!creds_path) - return -ENOMEM; + if (!creds_path) { + r = -ENOMEM; + goto finalize; + } } r = setup_namespace(root_dir, root_image, context->root_image_options, @@ -3174,6 +3176,7 @@ static int apply_mount_namespace( } } +finalize: bind_mount_free_many(bind_mounts, n_bind_mounts); return r; } From 89d36ce8f73990959032b78d1afb939cd6b5e843 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 27 Aug 2020 14:02:33 +0900 Subject: [PATCH 2/2] journal: fix divide-by-zero warning Fixes CID#1430209. --- src/journal/compress.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/journal/compress.c b/src/journal/compress.c index a59c2b7a88..852f9e07ba 100644 --- a/src/journal/compress.c +++ b/src/journal/compress.c @@ -927,11 +927,12 @@ int compress_stream_zstd(int fdf, int fdt, uint64_t max_bytes) { break; } - log_debug( - "ZSTD compression finished (%" PRIu64 " -> %" PRIu64 " bytes, %.1f%%)", - in_bytes, - max_bytes - left, - (double) (max_bytes - left) / in_bytes * 100); + if (in_bytes > 0) + log_debug("ZSTD compression finished (%" PRIu64 " -> %" PRIu64 " bytes, %.1f%%)", + in_bytes, max_bytes - left, (double) (max_bytes - left) / in_bytes * 100); + else + log_debug("ZSTD compression finished (%" PRIu64 " -> %" PRIu64 " bytes)", + in_bytes, max_bytes - left); return 0; #else