Merge ~rafaeldtinoco/ubuntu/+source/corosync:lp1869622-focal into ubuntu/+source/corosync:ubuntu/focal-devel

Proposed by Rafael David Tinoco
Status: Merged
Approved by: Christian Ehrhardt 
Approved revision: ed345808fd468fef054edb57151433457cf9c72d
Merged at revision: ed345808fd468fef054edb57151433457cf9c72d
Proposed branch: ~rafaeldtinoco/ubuntu/+source/corosync:lp1869622-focal
Merge into: ubuntu/+source/corosync:ubuntu/focal-devel
Diff against target: 971 lines (+823/-2)
22 files modified
debian/changelog (+30/-0)
debian/control (+3/-1)
debian/corosync-notifyd.init (+0/-1)
debian/patches/series (+19/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-09f6d34a-logconfig-Remove-double-free-of-value.patch (+25/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-0c118d8f-totemknet-Check-result-of-fcntl-O_NONBLOCK-call.patch (+32/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-0c16442f-votequorum-Change-check-of-expected_votes.patch (+51/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-1fb095b0-notifyd-Check-cmap_track_add-result.patch (+50/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-29109683-totemknet-Assert-strcpy-length.patch (+44/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-35c312f8-votequorum-Assert-copied-strings-length.patch (+38/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-380b744e-totemknet-Don-t-mix-corosync-and-knet-error-codes.patch (+52/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-56ee8503-quorumtool-Assert-copied-string-length.patch (+25/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-5f543465-quorumtool-exit-on-invalid-expected-votes.patch (+33/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-624b6a47-stats-Assert-value_len-when-value-is-needed.patch (+26/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-74eed54a-sync-Assert-sync_callbacks.name-length.patch (+27/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-89b0d62f-stats-Check-return-code-of-stats_map_get.patch (+26/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-8ce65bf9-votequorum-Reflect-runtime-change-of-2Node-to-WFA.patch (+80/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-8ff7760c-cmapctl-Free-bin_value-on-error.patch (+30/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-a24cbad5-totemconfig-Initialize-warnings-variable.patch (+26/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-c631951e-icmap-icmap_init_r-leaks-if-trie_create-fails.patch (+32/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-ca320bea-votequorum-set-wfa-status-only-on-startup.patch (+67/-0)
debian/patches/ubuntu-v3.0.3-fixes/lp1869622-efe48120-totemconfig-Free-leaks-found-by-coverity.patch (+107/-0)
Reviewer Review Type Date Requested Status
Christian Ehrhardt  (community) Approve
Canonical Server Core Reviewers Pending
Canonical Server Pending
Review via email: mp+381355@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

For the 2 fixes:

LP: #1437359
LP: #1677684

I have submitted to upstream the following merge request:

https://salsa.debian.org/ha-team/corosync/-/merge_requests/2

All other fixes are part of stabilizing the already released v3.0.3 version.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

* d/control: corosync binary depends on libqb-dev (LP: #1677684)

I'm ok with the change, we want to follow in 20.10 how Debian implements it to minimize delta again. E.g. if they split out corosync-blackbox to an extra package that is a fine solution as well to keep the amount of things installed down a bit.

The sub-dependencies of libqb-dev are not too bug (just libc and libqb0). I was wondering if it should be a recommends instead of a depends, but it actually is a dependency to properly execute things.
So for now +1 on this aspect and as I said on next version follow what the Debian MP resolved as.

---

* debian/corosync-notifyd.init: fix for 2 PIDFILEs declared (LP: #1437359)

Not much to say for this, having two seems wrong - the fix LGTM.
+1 on that as well.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

Post v3.0.3 release fixes backported to Ubuntu (LP: #1869622)

I appreciate stabilizing complex software stacks before the LTS release. I was checking headers/tags as well as non-FF violation of these changes.

- Fixes for unchecked results are good
- extra assertions on remote input is good (ans more secure as well)
- 2x WFA fixes seem correct
- double free's/lack-of-free's
- initialize/leak fixes

The WFA changes were less trivial than the others, but they are indeed fixes and not features.

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

I found no new issues introduced by any of the changes in the PPAs build log.
I know you have some HA testing in place and assume it already ran through that?

No FF violations and changes LGTM in general.
So please go on and upload +1

review: Approve
Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

Yep, my testing environment is already using the staging PPA:

(k)rafaeldtinoco@clufocal01:~$ dpkg -l | grep -i corosync
ii corosync 3.0.3-2ubuntu1+staging~1 amd64 cluster engine daemon and utilities
ii libcorosync-common4:amd64 3.0.3-2ubuntu1+staging~1 amd64 cluster engine common library

And I execute basic agents (fencing and resource) in all changes.

Thanks a lot for the review!

Revision history for this message
Rafael David Tinoco (rafaeldtinoco) wrote :

(c)rafaeldtinoco@clufocaldev:~/.../sources/ubuntu/corosync$ git push pkg upload/3.0.3-2ubuntu2
Enumerating objects: 44, done.
Counting objects: 100% (44/44), done.
Delta compression using up to 8 threads
Compressing objects: 100% (37/37), done.
Writing objects: 100% (37/37), 17.70 KiB | 2.21 MiB/s, done.
Total 37 (delta 12), reused 0 (delta 0)
To ssh://git.launchpad.net/~usd-import-team/ubuntu/+source/corosync
 * [new tag] upload/3.0.3-2ubuntu2 -> upload/3.0.3-2ubuntu2

(c)rafaeldtinoco@clufocaldev:~/.../sources/ubuntu/corosync$ dput ubuntu ../corosync_3.0.3-2ubuntu2_source.changes
Checking signature on .changes
gpg: ../corosync_3.0.3-2ubuntu2_source.changes: Valid signature from A93E0E0AD83C0D0F
Checking signature on .dsc
gpg: ../corosync_3.0.3-2ubuntu2.dsc: Valid signature from A93E0E0AD83C0D0F
Uploading to ubuntu (via ftp to upload.ubuntu.com):
  Uploading corosync_3.0.3-2ubuntu2.dsc: done.
  Uploading corosync_3.0.3-2ubuntu2.debian.tar.xz: done.
  Uploading corosync_3.0.3-2ubuntu2_source.buildinfo: done.
  Uploading corosync_3.0.3-2ubuntu2_source.changes: done.
Successfully uploaded packages.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 38bd809..4db0d92 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,33 @@
6+corosync (3.0.3-2ubuntu2) focal; urgency=medium
7+
8+ [Jorge Niedbalski]
9+ * d/control: corosync binary depends on libqb-dev (LP: #1677684)
10+
11+ [Rafael David Tinoco]
12+ * debian/corosync-notifyd.init: fix for 2 PIDFILEs declared (LP: #1437359)
13+ * Post v3.0.3 release fixes backported to Ubuntu (LP: #1869622)
14+ debian/patches/ubuntu-v3.0.3-fixes/:
15+ - lp1869622-09f6d34a-logconfig-Remove-double-free-of-value.patch
16+ - lp1869622-0c118d8f-totemknet-Check-result-of-fcntl-O_NONBLOCK-call.patch
17+ - lp1869622-0c16442f-votequorum-Change-check-of-expected_votes.patch
18+ - lp1869622-1fb095b0-notifyd-Check-cmap_track_add-result.patch
19+ - lp1869622-29109683-totemknet-Assert-strcpy-length.patch
20+ - lp1869622-35c312f8-votequorum-Assert-copied-strings-length.patch
21+ - lp1869622-380b744e-totemknet-Don-t-mix-corosync-and-knet-error-codes.patch
22+ - lp1869622-56ee8503-quorumtool-Assert-copied-string-length.patch
23+ - lp1869622-5f543465-quorumtool-exit-on-invalid-expected-votes.patch
24+ - lp1869622-624b6a47-stats-Assert-value_len-when-value-is-needed.patch
25+ - lp1869622-74eed54a-sync-Assert-sync_callbacks.name-length.patch
26+ - lp1869622-89b0d62f-stats-Check-return-code-of-stats_map_get.patch
27+ - lp1869622-8ce65bf9-votequorum-Reflect-runtime-change-of-2Node-to-WFA.patch
28+ - lp1869622-8ff7760c-cmapctl-Free-bin_value-on-error.patch
29+ - lp1869622-a24cbad5-totemconfig-Initialize-warnings-variable.patch
30+ - lp1869622-c631951e-icmap-icmap_init_r-leaks-if-trie_create-fails.patch
31+ - lp1869622-ca320bea-votequorum-set-wfa-status-only-on-startup.patch
32+ - lp1869622-efe48120-totemconfig-Free-leaks-found-by-coverity.patch
33+
34+ -- Rafael David Tinoco <rafaeldtinoco@ubuntu.com> Sun, 29 Mar 2020 21:50:35 +0000
35+
36 corosync (3.0.3-2ubuntu1) focal; urgency=medium
37
38 * Merge with Debian unstable (LP: #1864087). Remaining changes:
39diff --git a/debian/control b/debian/control
40index 22d4dd1..f939c65 100644
41--- a/debian/control
42+++ b/debian/control
43@@ -55,7 +55,9 @@ Depends: ${shlibs:Depends},
44 ${misc:Depends},
45 lsb-base (>= 3.0-6),
46 adduser,
47- xsltproc
48+ xsltproc,
49+# corosync-blackbox: qb-blackbox dependency (LP: #1677684)
50+ libqb-dev
51 Description: cluster engine daemon and utilities
52 ${S:X-Common-Description}
53 .
54diff --git a/debian/corosync-notifyd.init b/debian/corosync-notifyd.init
55index c908618..837e48a 100644
56--- a/debian/corosync-notifyd.init
57+++ b/debian/corosync-notifyd.init
58@@ -21,7 +21,6 @@ NAME=corosync-notifyd
59 DAEMON=/usr/sbin/$NAME
60 PIDFILE=/var/run/$NAME.pid
61 SCRIPTNAME=/etc/init.d/$NAME
62-PIDFILE=/var/run/corosync.pid
63 RARUNDIR=/var/run/resource-agents
64
65 # Exit if the package is not installed
66diff --git a/debian/patches/series b/debian/patches/series
67index 3045c12..e776e44 100644
68--- a/debian/patches/series
69+++ b/debian/patches/series
70@@ -3,3 +3,22 @@ Enable-PrivateTmp-in-the-systemd-service-files.patch
71 Make-the-example-config-valid.patch
72 man-fix-typo-avaialable.patch
73 man-move-cmap_keys-man-page-from-section-8-to-7.patch
74+# v3.0.3 post-release ubuntu fixes (LP: #1869622)
75+ubuntu-v3.0.3-fixes/lp1869622-09f6d34a-logconfig-Remove-double-free-of-value.patch
76+ubuntu-v3.0.3-fixes/lp1869622-0c118d8f-totemknet-Check-result-of-fcntl-O_NONBLOCK-call.patch
77+ubuntu-v3.0.3-fixes/lp1869622-0c16442f-votequorum-Change-check-of-expected_votes.patch
78+ubuntu-v3.0.3-fixes/lp1869622-1fb095b0-notifyd-Check-cmap_track_add-result.patch
79+ubuntu-v3.0.3-fixes/lp1869622-29109683-totemknet-Assert-strcpy-length.patch
80+ubuntu-v3.0.3-fixes/lp1869622-35c312f8-votequorum-Assert-copied-strings-length.patch
81+ubuntu-v3.0.3-fixes/lp1869622-380b744e-totemknet-Don-t-mix-corosync-and-knet-error-codes.patch
82+ubuntu-v3.0.3-fixes/lp1869622-56ee8503-quorumtool-Assert-copied-string-length.patch
83+ubuntu-v3.0.3-fixes/lp1869622-5f543465-quorumtool-exit-on-invalid-expected-votes.patch
84+ubuntu-v3.0.3-fixes/lp1869622-624b6a47-stats-Assert-value_len-when-value-is-needed.patch
85+ubuntu-v3.0.3-fixes/lp1869622-74eed54a-sync-Assert-sync_callbacks.name-length.patch
86+ubuntu-v3.0.3-fixes/lp1869622-89b0d62f-stats-Check-return-code-of-stats_map_get.patch
87+ubuntu-v3.0.3-fixes/lp1869622-8ce65bf9-votequorum-Reflect-runtime-change-of-2Node-to-WFA.patch
88+ubuntu-v3.0.3-fixes/lp1869622-8ff7760c-cmapctl-Free-bin_value-on-error.patch
89+ubuntu-v3.0.3-fixes/lp1869622-a24cbad5-totemconfig-Initialize-warnings-variable.patch
90+ubuntu-v3.0.3-fixes/lp1869622-c631951e-icmap-icmap_init_r-leaks-if-trie_create-fails.patch
91+ubuntu-v3.0.3-fixes/lp1869622-ca320bea-votequorum-set-wfa-status-only-on-startup.patch
92+ubuntu-v3.0.3-fixes/lp1869622-efe48120-totemconfig-Free-leaks-found-by-coverity.patch
93diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-09f6d34a-logconfig-Remove-double-free-of-value.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-09f6d34a-logconfig-Remove-double-free-of-value.patch
94new file mode 100644
95index 0000000..bbb349f
96--- /dev/null
97+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-09f6d34a-logconfig-Remove-double-free-of-value.patch
98@@ -0,0 +1,25 @@
99+From 09f6d34aaad5742533e5b36fda656973ca1482e8 Mon Sep 17 00:00:00 2001
100+From: Jan Friesse <jfriesse@redhat.com>
101+Date: Mon, 25 Nov 2019 18:26:35 +0100
102+Subject: [PATCH] logconfig: Remove double free of value
103+
104+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
105+
106+Origin: upstream, https://github.com/corosync/corosync/commit/09f6d34aaad
107+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
108+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
109+Last-Update: 2020-03-29
110+---
111+ exec/logconfig.c | 1 -
112+ 1 file changed, 1 deletion(-)
113+
114+--- a/exec/logconfig.c
115++++ b/exec/logconfig.c
116+@@ -542,7 +542,6 @@
117+ else {
118+ if (logsys_config_debug_set (subsys, LOGSYS_DEBUG_OFF) < 0) {
119+ error_reason = "unable to set debug off";
120+- free(value);
121+ goto parse_error;
122+ }
123+ }
124diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-0c118d8f-totemknet-Check-result-of-fcntl-O_NONBLOCK-call.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-0c118d8f-totemknet-Check-result-of-fcntl-O_NONBLOCK-call.patch
125new file mode 100644
126index 0000000..d42ce04
127--- /dev/null
128+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-0c118d8f-totemknet-Check-result-of-fcntl-O_NONBLOCK-call.patch
129@@ -0,0 +1,32 @@
130+From 0c118d8ff425ed6cf9af14b13a15ef62a91b86f6 Mon Sep 17 00:00:00 2001
131+From: Jan Friesse <jfriesse@redhat.com>
132+Date: Tue, 26 Nov 2019 13:05:42 +0100
133+Subject: [PATCH] totemknet: Check result of fcntl O_NONBLOCK call
134+
135+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
136+
137+Origin: upstream, https://github.com/corosync/corosync/commit/0c118d8ff4
138+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
139+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
140+Last-Update: 2020-03-29
141+---
142+ exec/totemknet.c | 8 ++++++--
143+ 1 file changed, 6 insertions(+), 2 deletions(-)
144+
145+--- a/exec/totemknet.c
146++++ b/exec/totemknet.c
147+@@ -967,8 +967,12 @@
148+ KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_CRIT, "failed to create pipe for instance->logpipes");
149+ goto exit_error;
150+ }
151+- fcntl(instance->logpipes[0], F_SETFL, O_NONBLOCK);
152+- fcntl(instance->logpipes[1], F_SETFL, O_NONBLOCK);
153++ if (fcntl(instance->logpipes[0], F_SETFL, O_NONBLOCK) == -1 ||
154++ fcntl(instance->logpipes[1], F_SETFL, O_NONBLOCK) == -1) {
155++ KNET_LOGSYS_PERROR(errno, LOGSYS_LEVEL_CRIT, "failed to set O_NONBLOCK flag for instance->logpipes");
156++ goto exit_error;
157++ }
158++
159+
160+ #if !defined(KNET_API_VER) || (KNET_API_VER == 1)
161+ instance->knet_handle = knet_handle_new(instance->totem_config->node_id, instance->logpipes[1], KNET_LOG_DEBUG);
162diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-0c16442f-votequorum-Change-check-of-expected_votes.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-0c16442f-votequorum-Change-check-of-expected_votes.patch
163new file mode 100644
164index 0000000..12ba58c
165--- /dev/null
166+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-0c16442f-votequorum-Change-check-of-expected_votes.patch
167@@ -0,0 +1,51 @@
168+From 0c16442f2d93f32a229b87d2672e2dc8025ec704 Mon Sep 17 00:00:00 2001
169+From: Jan Friesse <jfriesse@redhat.com>
170+Date: Wed, 4 Mar 2020 11:42:15 +0100
171+Subject: [PATCH] votequorum: Change check of expected_votes
172+
173+Previously value of new expected_votes was checked so newly computed
174+quorum value was in the interval <total_votes / 2, total_votes>. The
175+upper range prevented the cluster to become unquorate, but bottom check
176+was almost useless because it allowed to change expected_votes so it is
177+smaller than total_votes.
178+
179+Solution is to check if expected_votes is bigger or equal to total_votes
180+and for quorate cluster only check if cluster doesn't become unquorate
181+(for unquorate cluster one can set upper range freely - as it is
182+perfectly possible when using config file)
183+
184+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
185+Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
186+
187+Origin: upstream, https://github.com/corosync/corosync/commit/0c16442f2d
188+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
189+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
190+Last-Update: 2020-03-29
191+---
192+ exec/votequorum.c | 10 +++++++---
193+ 1 file changed, 7 insertions(+), 3 deletions(-)
194+
195+--- a/exec/votequorum.c
196++++ b/exec/votequorum.c
197+@@ -1,5 +1,5 @@
198+ /*
199+- * Copyright (c) 2009-2015 Red Hat, Inc.
200++ * Copyright (c) 2009-2020 Red Hat, Inc.
201+ *
202+ * All rights reserved.
203+ *
204+@@ -2668,8 +2668,12 @@
205+ */
206+ newquorum = calculate_quorum(1, req_lib_votequorum_setexpected->expected_votes, &total_votes);
207+ allow_downscale = allow_downscale_status;
208+- if (newquorum < total_votes / 2 ||
209+- newquorum > total_votes) {
210++ /*
211++ * Setting expected_votes < total_votes doesn't make sense.
212++ * For quorate cluster prevent cluster to become unquorate.
213++ */
214++ if (req_lib_votequorum_setexpected->expected_votes < total_votes ||
215++ (cluster_is_quorate && (newquorum > total_votes))) {
216+ error = CS_ERR_INVALID_PARAM;
217+ goto error_exit;
218+ }
219diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-1fb095b0-notifyd-Check-cmap_track_add-result.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-1fb095b0-notifyd-Check-cmap_track_add-result.patch
220new file mode 100644
221index 0000000..4d4c486
222--- /dev/null
223+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-1fb095b0-notifyd-Check-cmap_track_add-result.patch
224@@ -0,0 +1,50 @@
225+From 1fb095b0afe509305bffa8c7ca50c002e3965552 Mon Sep 17 00:00:00 2001
226+From: Jan Friesse <jfriesse@redhat.com>
227+Date: Tue, 26 Nov 2019 14:17:53 +0100
228+Subject: [PATCH] notifyd: Check cmap_track_add result
229+
230+And assert length of key_name to strcpy.
231+
232+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
233+
234+Origin: upstream, https://github.com/corosync/corosync/commit/1fb095b0af
235+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
236+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
237+Last-Update: 2020-03-29
238+---
239+ tools/corosync-notifyd.c | 13 ++++++++++++-
240+ 1 file changed, 12 insertions(+), 1 deletion(-)
241+
242+--- a/tools/corosync-notifyd.c
243++++ b/tools/corosync-notifyd.c
244+@@ -382,18 +382,29 @@
245+ void *user_data)
246+ {
247+ struct track_item *track_item;
248++ cs_error_t err;
249+
250+ /* Add/remove a tracker for a new/removed knet link */
251+ if (strstr(key_name, ".connected")) {
252+ if (event == CMAP_TRACK_ADD) {
253++ assert(strlen(key_name) < sizeof(track_item->key_name));
254+
255+ track_item = malloc(sizeof(struct track_item));
256+ if (!track_item) {
257++ qb_log(LOG_WARNING, "Can't alloc track_item for new/removed knet link");
258+ return;
259+ }
260+- cmap_track_add(stats_handle, key_name, CMAP_TRACK_MODIFY, _cs_cmap_link_faulty_key_changed, NULL, &track_handle);
261++ err = cmap_track_add(stats_handle, key_name, CMAP_TRACK_MODIFY,
262++ _cs_cmap_link_faulty_key_changed, NULL, &track_handle);
263++ if (err != CS_OK) {
264++ qb_log(LOG_WARNING, "Can't add tracker for new/removed knet link");
265++
266++ free(track_item);
267++ return ;
268++ }
269+
270+ strcpy(track_item->key_name, key_name);
271++
272+ track_item->track_handle = track_handle;
273+ qb_map_put(tracker_map, track_item->key_name, track_item);
274+ } else {
275diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-29109683-totemknet-Assert-strcpy-length.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-29109683-totemknet-Assert-strcpy-length.patch
276new file mode 100644
277index 0000000..1143dc4
278--- /dev/null
279+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-29109683-totemknet-Assert-strcpy-length.patch
280@@ -0,0 +1,44 @@
281+From 29109683cf29966181fcc6bc9ef50d0bd48e5778 Mon Sep 17 00:00:00 2001
282+From: Jan Friesse <jfriesse@redhat.com>
283+Date: Tue, 26 Nov 2019 13:13:53 +0100
284+Subject: [PATCH] totemknet: Assert strcpy length
285+
286+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
287+
288+Origin: upstream, https://github.com/corosync/corosync/commit/29109683cf
289+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
290+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
291+Last-Update: 2020-03-29
292+---
293+ exec/totemknet.c | 9 +++++++++
294+ 1 file changed, 9 insertions(+)
295+
296+--- a/exec/totemknet.c
297++++ b/exec/totemknet.c
298+@@ -1022,9 +1022,16 @@
299+ if (strcmp(instance->totem_config->crypto_cipher_type, "none") != 0) {
300+ struct knet_handle_crypto_cfg crypto_cfg;
301+
302++ assert(strlen(instance->totem_config->crypto_model) < sizeof(crypto_cfg.crypto_model));
303+ strcpy(crypto_cfg.crypto_model, instance->totem_config->crypto_model);
304++
305++ assert(strlen(instance->totem_config->crypto_cipher_type) < sizeof(crypto_cfg.crypto_cipher_type));
306+ strcpy(crypto_cfg.crypto_cipher_type, instance->totem_config->crypto_cipher_type);
307++
308++ assert(strlen(instance->totem_config->crypto_hash_type) < sizeof(crypto_cfg.crypto_hash_type));
309+ strcpy(crypto_cfg.crypto_hash_type, instance->totem_config->crypto_hash_type);
310++
311++ assert(instance->totem_config->private_key_len <= sizeof(crypto_cfg.private_key));
312+ memcpy(crypto_cfg.private_key, instance->totem_config->private_key, instance->totem_config->private_key_len);
313+ crypto_cfg.private_key_len = instance->totem_config->private_key_len;
314+
315+@@ -1450,7 +1457,9 @@
316+ int res = 0;
317+
318+ if (totem_config->knet_compression_model) {
319++ assert(strlen(totem_config->knet_compression_model) < sizeof(compress_cfg.compress_model));
320+ strcpy(compress_cfg.compress_model, totem_config->knet_compression_model);
321++
322+ compress_cfg.compress_threshold = totem_config->knet_compression_threshold;
323+ compress_cfg.compress_level = totem_config->knet_compression_level;
324+
325diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-35c312f8-votequorum-Assert-copied-strings-length.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-35c312f8-votequorum-Assert-copied-strings-length.patch
326new file mode 100644
327index 0000000..efe45c3
328--- /dev/null
329+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-35c312f8-votequorum-Assert-copied-strings-length.patch
330@@ -0,0 +1,38 @@
331+From 35c312f810738faa2965bc8771528198b966ef39 Mon Sep 17 00:00:00 2001
332+From: Jan Friesse <jfriesse@redhat.com>
333+Date: Tue, 26 Nov 2019 13:52:27 +0100
334+Subject: [PATCH] votequorum: Assert copied strings length
335+
336+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
337+
338+Origin: upstream, https://github.com/corosync/corosync/commit/35c312f810
339+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
340+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
341+Last-Update: 2020-03-29
342+---
343+ exec/votequorum.c | 6 ++++++
344+ 1 file changed, 6 insertions(+)
345+
346+--- a/exec/votequorum.c
347++++ b/exec/votequorum.c
348+@@ -1713,7 +1713,11 @@
349+
350+ req_exec_quorum_qdevice_reconfigure.header.id = SERVICE_ID_MAKE(VOTEQUORUM_SERVICE, MESSAGE_REQ_EXEC_VOTEQUORUM_QDEVICE_RECONFIGURE);
351+ req_exec_quorum_qdevice_reconfigure.header.size = sizeof(req_exec_quorum_qdevice_reconfigure);
352++
353++ assert(strlen(oldname) < sizeof(req_exec_quorum_qdevice_reconfigure.oldname));
354+ strcpy(req_exec_quorum_qdevice_reconfigure.oldname, oldname);
355++
356++ assert(strlen(newname) < sizeof(req_exec_quorum_qdevice_reconfigure.newname));
357+ strcpy(req_exec_quorum_qdevice_reconfigure.newname, newname);
358+
359+ iov[0].iov_base = (void *)&req_exec_quorum_qdevice_reconfigure;
360+@@ -1736,6 +1740,8 @@
361+ req_exec_quorum_qdevice_reg.header.id = SERVICE_ID_MAKE(VOTEQUORUM_SERVICE, MESSAGE_REQ_EXEC_VOTEQUORUM_QDEVICE_REG);
362+ req_exec_quorum_qdevice_reg.header.size = sizeof(req_exec_quorum_qdevice_reg);
363+ req_exec_quorum_qdevice_reg.operation = operation;
364++
365++ assert(strlen(qdevice_name_req) < sizeof(req_exec_quorum_qdevice_reg.qdevice_name));
366+ strcpy(req_exec_quorum_qdevice_reg.qdevice_name, qdevice_name_req);
367+
368+ iov[0].iov_base = (void *)&req_exec_quorum_qdevice_reg;
369diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-380b744e-totemknet-Don-t-mix-corosync-and-knet-error-codes.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-380b744e-totemknet-Don-t-mix-corosync-and-knet-error-codes.patch
370new file mode 100644
371index 0000000..6b92300
372--- /dev/null
373+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-380b744e-totemknet-Don-t-mix-corosync-and-knet-error-codes.patch
374@@ -0,0 +1,52 @@
375+From 380b744ec82e65f58eeeea53a99e0561b360e710 Mon Sep 17 00:00:00 2001
376+From: Jan Friesse <jfriesse@redhat.com>
377+Date: Tue, 26 Nov 2019 10:26:36 +0100
378+Subject: [PATCH] totemknet: Don't mix corosync and knet error codes
379+
380+And use correct return code in stats.c.
381+
382+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
383+
384+Origin: upstream, https://github.com/corosync/corosync/commit/380b744ec8
385+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
386+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
387+Last-Update: 2020-03-29
388+---
389+ exec/stats.c | 2 +-
390+ exec/totemknet.c | 9 ++++++++-
391+ 2 files changed, 9 insertions(+), 2 deletions(-)
392+
393+--- a/exec/stats.c
394++++ b/exec/stats.c
395+@@ -324,7 +324,7 @@
396+ break;
397+ case STAT_KNET_HANDLE:
398+ res = totemknet_handle_get_stats(&knet_handle_stats);
399+- if (res) {
400++ if (res != CS_OK) {
401+ return res;
402+ }
403+ stats_map_set_value(statinfo, &knet_handle_stats, value, value_len, type);
404+--- a/exec/totemknet.c
405++++ b/exec/totemknet.c
406+@@ -1528,12 +1528,19 @@
407+ int totemknet_handle_get_stats (
408+ struct knet_handle_stats *stats)
409+ {
410++ int res;
411++
412+ /* We are probably not using knet */
413+ if (!global_instance) {
414+ return CS_ERR_NOT_EXIST;
415+ }
416+
417+- return knet_handle_get_stats(global_instance->knet_handle, stats, sizeof(struct knet_handle_stats));
418++ res = knet_handle_get_stats(global_instance->knet_handle, stats, sizeof(struct knet_handle_stats));
419++ if (res != 0) {
420++ return (qb_to_cs_error(-errno));
421++ }
422++
423++ return CS_OK;
424+ }
425+
426+ static void timer_function_merge_detect_timeout (
427diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-56ee8503-quorumtool-Assert-copied-string-length.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-56ee8503-quorumtool-Assert-copied-string-length.patch
428new file mode 100644
429index 0000000..40daf9a
430--- /dev/null
431+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-56ee8503-quorumtool-Assert-copied-string-length.patch
432@@ -0,0 +1,25 @@
433+From 56ee850301ae08213e19a163443a8d0f0b5068aa Mon Sep 17 00:00:00 2001
434+From: Jan Friesse <jfriesse@redhat.com>
435+Date: Tue, 26 Nov 2019 15:05:46 +0100
436+Subject: [PATCH] quorumtool: Assert copied string length
437+
438+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
439+
440+Origin: upstream, https://github.com/corosync/corosync/commit/56ee850301
441+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
442+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
443+Last-Update: 2020-03-29
444+---
445+ tools/corosync-quorumtool.c | 1 +
446+ 1 file changed, 1 insertion(+)
447+
448+--- a/tools/corosync-quorumtool.c
449++++ b/tools/corosync-quorumtool.c
450+@@ -334,6 +334,7 @@
451+ if ((nodelist_name) &&
452+ (strlen(nodelist_name) > 0)) {
453+ start_addr = 1;
454++ assert(strlen(nodelist_name) < sizeof(buf));
455+ strcpy(buf, nodelist_name);
456+ bufptr = strlen(buf);
457+ }
458diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-5f543465-quorumtool-exit-on-invalid-expected-votes.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-5f543465-quorumtool-exit-on-invalid-expected-votes.patch
459new file mode 100644
460index 0000000..b29602e
461--- /dev/null
462+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-5f543465-quorumtool-exit-on-invalid-expected-votes.patch
463@@ -0,0 +1,33 @@
464+From 5f543465bb3506b7f4929a426f1c22a9c854cecd Mon Sep 17 00:00:00 2001
465+From: Jan Friesse <jfriesse@redhat.com>
466+Date: Wed, 4 Mar 2020 08:53:41 +0100
467+Subject: [PATCH] quorumtool: exit on invalid expected votes
468+
469+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
470+Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
471+
472+Origin: upstream, https://github.com/corosync/corosync/commit/5f543465bb
473+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
474+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
475+Last-Update: 2020-03-29
476+---
477+ tools/corosync-quorumtool.c | 3 ++-
478+ 1 file changed, 2 insertions(+), 1 deletion(-)
479+
480+--- a/tools/corosync-quorumtool.c
481++++ b/tools/corosync-quorumtool.c
482+@@ -1,5 +1,5 @@
483+ /*
484+- * Copyright (c) 2009-2019 Red Hat, Inc.
485++ * Copyright (c) 2009-2020 Red Hat, Inc.
486+ *
487+ * All rights reserved.
488+ *
489+@@ -937,6 +937,7 @@
490+ votes = strtol(optarg, &endptr, 0);
491+ if ((votes == 0 && endptr == optarg) || votes <= 0) {
492+ fprintf(stderr, "New expected votes value was not valid, try a positive number\n");
493++ exit(EXIT_FAILURE);
494+ } else {
495+ command_opt = CMD_SETEXPECTED;
496+ }
497diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-624b6a47-stats-Assert-value_len-when-value-is-needed.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-624b6a47-stats-Assert-value_len-when-value-is-needed.patch
498new file mode 100644
499index 0000000..ff09af0
500--- /dev/null
501+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-624b6a47-stats-Assert-value_len-when-value-is-needed.patch
502@@ -0,0 +1,26 @@
503+From 624b6a4707c688dae00f52833e0a2cd4f53fa38d Mon Sep 17 00:00:00 2001
504+From: Jan Friesse <jfriesse@redhat.com>
505+Date: Tue, 26 Nov 2019 10:10:42 +0100
506+Subject: [PATCH] stats: Assert value_len when value is needed
507+
508+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
509+
510+Origin: upstream, https://github.com/corosync/corosync/commit/624b6a4707
511+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
512+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
513+Last-Update: 2020-03-29
514+---
515+ exec/stats.c | 2 ++
516+ 1 file changed, 2 insertions(+)
517+
518+--- a/exec/stats.c
519++++ b/exec/stats.c
520+@@ -233,6 +233,8 @@
521+ }
522+ }
523+ if (value) {
524++ assert(value_len != NULL);
525++
526+ memcpy(value, (char *)(stat_array) + conv->offset, *value_len);
527+ }
528+ }
529diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-74eed54a-sync-Assert-sync_callbacks.name-length.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-74eed54a-sync-Assert-sync_callbacks.name-length.patch
530new file mode 100644
531index 0000000..fbd3d2c
532--- /dev/null
533+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-74eed54a-sync-Assert-sync_callbacks.name-length.patch
534@@ -0,0 +1,27 @@
535+From 74eed54a7fcd52924bdcb7fdf1226cceb51cfd22 Mon Sep 17 00:00:00 2001
536+From: Jan Friesse <jfriesse@redhat.com>
537+Date: Tue, 26 Nov 2019 13:01:16 +0100
538+Subject: [PATCH] sync: Assert sync_callbacks.name length
539+
540+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
541+
542+Origin: upstream, https://github.com/corosync/corosync/commit/74eed54a7f
543+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
544+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
545+Last-Update: 2020-03-29
546+---
547+ exec/sync.c | 3 +++
548+ 1 file changed, 3 insertions(+)
549+
550+--- a/exec/sync.c
551++++ b/exec/sync.c
552+@@ -466,6 +466,9 @@
553+ }
554+ my_service_list[my_service_list_entries].state = PROCESS;
555+ my_service_list[my_service_list_entries].service_id = i;
556++
557++ assert(strlen(sync_callbacks.name) < sizeof(my_service_list[my_service_list_entries].name));
558++
559+ strcpy (my_service_list[my_service_list_entries].name,
560+ sync_callbacks.name);
561+ my_service_list[my_service_list_entries].sync_init = sync_callbacks.sync_init;
562diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-89b0d62f-stats-Check-return-code-of-stats_map_get.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-89b0d62f-stats-Check-return-code-of-stats_map_get.patch
563new file mode 100644
564index 0000000..88c7060
565--- /dev/null
566+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-89b0d62f-stats-Check-return-code-of-stats_map_get.patch
567@@ -0,0 +1,26 @@
568+From 89b0d62f8bd9d5ba90db5a37866c029b821da838 Mon Sep 17 00:00:00 2001
569+From: Jan Friesse <jfriesse@redhat.com>
570+Date: Tue, 26 Nov 2019 16:47:31 +0100
571+Subject: [PATCH] stats: Check return code of stats_map_get
572+
573+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
574+
575+Origin: upstream, https://github.com/corosync/corosync/commit/89b0d62f8b
576+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
577+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
578+Last-Update: 2020-03-29
579+---
580+ exec/stats.c | 2 ++
581+ 1 file changed, 2 insertions(+)
582+
583+--- a/exec/stats.c
584++++ b/exec/stats.c
585+@@ -505,6 +505,8 @@
586+ &new_value,
587+ &new_val.len,
588+ &new_val.type) != CS_OK) {
589++ log_printf(LOGSYS_LEVEL_WARNING, "get value of notified key %s failed", key);
590++ return ;
591+ }
592+
593+ /* We don't know what the old value was
594diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-8ce65bf9-votequorum-Reflect-runtime-change-of-2Node-to-WFA.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-8ce65bf9-votequorum-Reflect-runtime-change-of-2Node-to-WFA.patch
595new file mode 100644
596index 0000000..e47e65c
597--- /dev/null
598+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-8ce65bf9-votequorum-Reflect-runtime-change-of-2Node-to-WFA.patch
599@@ -0,0 +1,80 @@
600+From 8ce65bf951bc1e5b2d64b60ea027fbdc551d4fc8 Mon Sep 17 00:00:00 2001
601+From: Jan Friesse <jfriesse@redhat.com>
602+Date: Thu, 16 Jan 2020 15:43:59 +0100
603+Subject: [PATCH] votequorum: Reflect runtime change of 2Node to WFA
604+
605+When 2Node mode is set, WFA is also set unless WFA is configured
606+explicitly. This behavior was not reflected on runtime change, so
607+restarted corosync behavior was different (WFA not set). Also when
608+cluster is reduced from 3 nodes to 2 nodes during runtime, WFA was not
609+set, what may result in two quorate partitions.
610+
611+Solution is to set WFA depending on 2Node when WFA
612+is not explicitly configured.
613+
614+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
615+Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
616+
617+Origin: upstream, https://github.com/corosync/corosync/commit/8ce65bf951
618+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
619+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
620+Last-Update: 2020-03-29
621+---
622+ exec/votequorum.c | 24 +++++++++++++++++++-----
623+ 1 file changed, 19 insertions(+), 5 deletions(-)
624+
625+--- a/exec/votequorum.c
626++++ b/exec/votequorum.c
627+@@ -80,6 +80,7 @@
628+
629+ static uint8_t wait_for_all = 0;
630+ static uint8_t wait_for_all_status = 0;
631++static uint8_t wait_for_all_autoset = 0; /* Wait for all is not set explicitly and follows two_node */
632+
633+ static enum {ATB_NONE, ATB_LOWEST, ATB_HIGHEST, ATB_LIST} auto_tie_breaker = ATB_NONE, initial_auto_tie_breaker = ATB_NONE;
634+ static int lowest_node_id = -1;
635+@@ -1315,12 +1316,10 @@
636+ * Enable special features
637+ */
638+ if (!runtime) {
639+- if (two_node) {
640+- wait_for_all = 1;
641+- }
642+-
643+ icmap_get_uint8("quorum.allow_downscale", &allow_downscale);
644+- icmap_get_uint8("quorum.wait_for_all", &wait_for_all);
645++ if (icmap_get_uint8("quorum.wait_for_all", &wait_for_all) != CS_OK) {
646++ wait_for_all_autoset = 1;
647++ }
648+ icmap_get_uint8("quorum.last_man_standing", &last_man_standing);
649+ icmap_get_uint32("quorum.last_man_standing_window", &last_man_standing_window);
650+ icmap_get_uint8("quorum.expected_votes_tracking", &ev_tracking);
651+@@ -1361,6 +1360,15 @@
652+
653+ }
654+
655++ /*
656++ * Changing of wait_for_all during runtime is not supported, but changing of two_node is
657++ * and two_node may set wfa if not configured explicitly. It is safe to unset it
658++ * (or set it back) when two_node changes.
659++ */
660++ if (wait_for_all_autoset) {
661++ wait_for_all = two_node;
662++ }
663++
664+ /* two_node and auto_tie_breaker are not compatible as two_node uses
665+ * a fence race to decide quorum whereas ATB decides based on node id
666+ */
667+@@ -1540,6 +1548,12 @@
668+ update_two_node();
669+ if (wait_for_all) {
670+ update_wait_for_all_status(1);
671++ } else if (wait_for_all_autoset && wait_for_all_status) {
672++ /*
673++ * Reset wait for all status for consistency when wfa is auto-unset by 2node.
674++ * wait_for_all_status would be ignored by are_we_quorate anyway.
675++ */
676++ update_wait_for_all_status(0);
677+ }
678+
679+ out:
680diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-8ff7760c-cmapctl-Free-bin_value-on-error.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-8ff7760c-cmapctl-Free-bin_value-on-error.patch
681new file mode 100644
682index 0000000..1ffd93d
683--- /dev/null
684+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-8ff7760c-cmapctl-Free-bin_value-on-error.patch
685@@ -0,0 +1,30 @@
686+From 8ff7760ce5ba5e23cbdd0124a254a41aee6033ab Mon Sep 17 00:00:00 2001
687+From: Jan Friesse <jfriesse@redhat.com>
688+Date: Tue, 26 Nov 2019 14:09:14 +0100
689+Subject: [PATCH] cmapctl: Free bin_value on error
690+
691+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
692+
693+Origin: upstream, https://github.com/corosync/corosync/commit/8ff7760ce5
694+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
695+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
696+Last-Update: 2020-03-29
697+---
698+ tools/corosync-cmapctl.c | 6 ++++++
699+ 1 file changed, 6 insertions(+)
700+
701+--- a/tools/corosync-cmapctl.c
702++++ b/tools/corosync-cmapctl.c
703+@@ -316,6 +316,12 @@
704+ if (err != CS_OK) {
705+ fprintf(stderr, "Can't get value of %s. Error %s\n", key_name, cs_strerror(err));
706+
707++ /*
708++ * bin_value was newly allocated
709++ */
710++ if (bin_value != NULL && value == NULL) {
711++ free(bin_value);
712++ }
713+ return ;
714+ }
715+
716diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-a24cbad5-totemconfig-Initialize-warnings-variable.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-a24cbad5-totemconfig-Initialize-warnings-variable.patch
717new file mode 100644
718index 0000000..334e407
719--- /dev/null
720+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-a24cbad5-totemconfig-Initialize-warnings-variable.patch
721@@ -0,0 +1,26 @@
722+From a24cbad59007ff2507cfa4cb562696f7c634f31f Mon Sep 17 00:00:00 2001
723+From: Jan Friesse <jfriesse@redhat.com>
724+Date: Tue, 26 Nov 2019 13:02:04 +0100
725+Subject: [PATCH] totemconfig: Initialize warnings variable
726+
727+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
728+
729+Origin: upstream, https://github.com/corosync/corosync/commit/a24cbad590
730+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
731+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
732+Last-Update: 2020-03-29
733+---
734+ exec/totemconfig.c | 2 +-
735+ 1 file changed, 1 insertion(+), 1 deletion(-)
736+
737+--- a/exec/totemconfig.c
738++++ b/exec/totemconfig.c
739+@@ -2266,7 +2266,7 @@
740+ {
741+ struct totem_config *totem_config = (struct totem_config *)user_data;
742+ const char *error_string;
743+- uint64_t warnings;
744++ uint64_t warnings = 0;
745+
746+ /* Reload has completed */
747+ if (*(uint8_t *)new_val.data == 0) {
748diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-c631951e-icmap-icmap_init_r-leaks-if-trie_create-fails.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-c631951e-icmap-icmap_init_r-leaks-if-trie_create-fails.patch
749new file mode 100644
750index 0000000..4a6a15f
751--- /dev/null
752+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-c631951e-icmap-icmap_init_r-leaks-if-trie_create-fails.patch
753@@ -0,0 +1,32 @@
754+From c631951ef5ab870b0877bd2c0909c8157c7eeb20 Mon Sep 17 00:00:00 2001
755+From: Christine Caulfield <ccaulfie@redhat.com>
756+Date: Thu, 26 Mar 2020 10:26:16 +0000
757+Subject: [PATCH] icmap: icmap_init_r() leaks if trie_create() fails
758+
759+Thanks to Coverity for finding this
760+
761+Signed-off-by: Christine Caulfield <ccaulfie@redhat.com>
762+Reviewed-by: Jan Friesse <jfriesse@redhat.com>
763+
764+Origin: upstream, https://github.com/corosync/corosync/commit/c631951ef5
765+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
766+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
767+Last-Update: 2020-03-29
768+---
769+ exec/icmap.c | 4 +++-
770+ 1 file changed, 3 insertions(+), 1 deletion(-)
771+
772+--- a/exec/icmap.c
773++++ b/exec/icmap.c
774+@@ -195,8 +195,10 @@
775+ }
776+
777+ (*result)->qb_map = qb_trie_create();
778+- if ((*result)->qb_map == NULL)
779++ if ((*result)->qb_map == NULL) {
780++ free(*result);
781+ return (CS_ERR_INIT);
782++ }
783+
784+ err = qb_map_notify_add((*result)->qb_map, NULL, icmap_map_free_cb, QB_MAP_NOTIFY_FREE, NULL);
785+
786diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-ca320bea-votequorum-set-wfa-status-only-on-startup.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-ca320bea-votequorum-set-wfa-status-only-on-startup.patch
787new file mode 100644
788index 0000000..cd88bcf
789--- /dev/null
790+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-ca320bea-votequorum-set-wfa-status-only-on-startup.patch
791@@ -0,0 +1,67 @@
792+From ca320beac25f82c0c555799e647a47975a333c28 Mon Sep 17 00:00:00 2001
793+From: Jan Friesse <jfriesse@redhat.com>
794+Date: Tue, 10 Mar 2020 17:49:27 +0100
795+Subject: [PATCH] votequorum: set wfa status only on startup
796+
797+Previously reload of configuration with enabled wait_for_all result in
798+set of wait_for_all_status which set cluster_is_quorate to 0 but didn't
799+inform the quorum service so votequorum and quorum information may get
800+out of sync.
801+
802+Example is 1 node cluster, which is extended to 3 nodes. Quorum service
803+reports cluster as a quorate (incorrect) and votequorum as not-quorate
804+(correct). Similar behavior happens when extending cluster in general,
805+but some configurations are less incorrect (3->4).
806+
807+Discussed solution was to inform quorum service but that would mean
808+every reload would cause loss of quorum until all nodes would be seen
809+again.
810+
811+Such behaviour is consistent but seems to be a bit too strict.
812+
813+Proposed solution sets wait_for_all_status only on startup and
814+doesn't touch it during reload.
815+
816+This solution fulfills requirement of "cluster will be quorate for
817+the first time only after all nodes have been visible at least
818+once at the same time." because node clears wait_for_all_status only
819+after it sees all other nodes or joins cluster which is quorate. It also
820+solves problem with extending cluster, because when cluster becomes
821+unquorate (1->3) wait_for_all_status is set.
822+
823+Added assert is only for ensure that I haven't missed any case when
824+quorate cluster may become unquorate.
825+
826+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
827+Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
828+
829+Origin: upstream, https://github.com/corosync/corosync/commit/ca320beac2
830+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
831+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
832+Last-Update: 2020-03-29
833+---
834+ exec/votequorum.c | 6 ++++--
835+ 1 file changed, 4 insertions(+), 2 deletions(-)
836+
837+--- a/exec/votequorum.c
838++++ b/exec/votequorum.c
839+@@ -1009,7 +1009,7 @@
840+ "Waiting for all cluster members. "
841+ "Current votes: %d expected_votes: %d",
842+ total_votes, us->expected_votes);
843+- cluster_is_quorate = 0;
844++ assert(!cluster_is_quorate);
845+ return;
846+ }
847+ update_wait_for_all_status(0);
848+@@ -1547,7 +1547,9 @@
849+ update_ev_barrier(us->expected_votes);
850+ update_two_node();
851+ if (wait_for_all) {
852+- update_wait_for_all_status(1);
853++ if (!runtime) {
854++ update_wait_for_all_status(1);
855++ }
856+ } else if (wait_for_all_autoset && wait_for_all_status) {
857+ /*
858+ * Reset wait for all status for consistency when wfa is auto-unset by 2node.
859diff --git a/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-efe48120-totemconfig-Free-leaks-found-by-coverity.patch b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-efe48120-totemconfig-Free-leaks-found-by-coverity.patch
860new file mode 100644
861index 0000000..2dcf090
862--- /dev/null
863+++ b/debian/patches/ubuntu-v3.0.3-fixes/lp1869622-efe48120-totemconfig-Free-leaks-found-by-coverity.patch
864@@ -0,0 +1,107 @@
865+From efe48120e2d0db300a22da09c65465091ebfae68 Mon Sep 17 00:00:00 2001
866+From: Jan Friesse <jfriesse@redhat.com>
867+Date: Mon, 25 Nov 2019 18:16:36 +0100
868+Subject: [PATCH] totemconfig: Free leaks found by coverity
869+
870+Signed-off-by: Jan Friesse <jfriesse@redhat.com>
871+
872+Origin: upstream, https://github.com/corosync/corosync/commit/efe48120e2
873+Bug-Ubuntu: https://bugs.launchpad.net/bugs/1869622
874+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
875+Last-Update: 2020-03-29
876+---
877+ exec/totemconfig.c | 26 +++++++++++++++++---------
878+ 1 file changed, 17 insertions(+), 9 deletions(-)
879+
880+--- a/exec/totemconfig.c
881++++ b/exec/totemconfig.c
882+@@ -470,6 +470,8 @@
883+ "for a multi-link configuration, all nodes must have a 'name' attribute");
884+ goto parse_error;
885+ }
886++
887++ free(name_str);
888+ }
889+
890+ for (i=0; i < INTERFACE_MAX; i++) {
891+@@ -1445,6 +1447,7 @@
892+ char *str;
893+ char *cluster_name = NULL;
894+ enum totem_ip_version_enum tmp_ip_version = TOTEM_IP_VERSION_4;
895++ int ret = 0;
896+
897+ if (reload) {
898+ for (i=0; i<INTERFACE_MAX; i++) {
899+@@ -1479,14 +1482,13 @@
900+ linknumber = atoi(linknumber_key);
901+
902+ if (linknumber >= INTERFACE_MAX) {
903+- free(cluster_name);
904+-
905+ snprintf (error_string_response, sizeof(error_string_response),
906+ "parse error in config: interface ring number %u is bigger than allowed maximum %u\n",
907+ linknumber, INTERFACE_MAX - 1);
908+
909+ *error_string = error_string_response;
910+- return -1;
911++ ret = -1;
912++ goto out;
913+ }
914+
915+ /* These things are only valid for the initial read */
916+@@ -1505,7 +1507,8 @@
917+ *error_string = error_string_response;
918+ free(str);
919+
920+- return -1;
921++ ret = -1;
922++ goto out;
923+ }
924+
925+ free(str);
926+@@ -1524,7 +1527,8 @@
927+ *error_string = error_string_response;
928+ free(str);
929+
930+- return -1;
931++ ret = -1;
932++ goto out;
933+ }
934+
935+ free(str);
936+@@ -1594,7 +1598,8 @@
937+ }
938+ else {
939+ *error_string = "Unrecognised knet_transport. expected 'udp' or 'sctp'";
940+- return -1;
941++ ret = -1;
942++ goto out;
943+ }
944+ }
945+ }
946+@@ -1652,9 +1657,9 @@
947+ *error_string = error_string_response;
948+
949+ icmap_iter_finalize(member_iter);
950+- icmap_iter_finalize(iter);
951+ free(str);
952+- return -1;
953++ ret = -1;
954++ goto out;
955+ }
956+
957+ free(str);
958+@@ -1665,9 +1670,12 @@
959+ totem_config->interfaces[linknumber].member_count = member_count;
960+
961+ }
962++
963++out:
964+ icmap_iter_finalize(iter);
965++ free(cluster_name);
966+
967+- return 0;
968++ return (ret);
969+ }
970+
971+ extern int totem_config_read (

Subscribers

People subscribed via source and target branches