gfs2-utils: master - fsck.gfs2: Handle gfs2_readi() errors in
check_statfs()
by Andrew Price
Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=dcbde3c1...
Commit: dcbde3c14ae223e36daca420bb3a8f3a269a9398
Parent: 9add3ea518e7c64cbea464571a543d4c8365635c
Author: Andrew Price <anprice(a)redhat.com>
AuthorDate: Fri Nov 11 13:24:34 2016 +0000
Committer: Andrew Price <anprice(a)redhat.com>
CommitterDate: Fri Nov 11 13:28:18 2016 +0000
fsck.gfs2: Handle gfs2_readi() errors in check_statfs()
Discovered by static analysis with clang.
Related: rhbz#1394235
Signed-off-by: Andrew Price <anprice(a)redhat.com>
---
gfs2/fsck/main.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/gfs2/fsck/main.c b/gfs2/fsck/main.c
index c5967bc..51f3e03 100644
--- a/gfs2/fsck/main.c
+++ b/gfs2/fsck/main.c
@@ -170,9 +170,12 @@ static int check_statfs(struct gfs2_sbd *sdp)
/* Read the current statfs values */
count = gfs2_readi(sdp->md.statfs, buf, 0,
sdp->md.statfs->i_di.di_size);
- if (count == sizeof(struct gfs2_statfs_change))
- gfs2_statfs_change_in(&sc, buf);
-
+ if (count != sizeof(struct gfs2_statfs_change)) {
+ log_err(_("Failed to read statfs values (%d of %"PRIu64" read)\n"),
+ count, (uint64_t)sdp->md.statfs->i_di.di_size);
+ return FSCK_ERROR;
+ }
+ gfs2_statfs_change_in(&sc, buf);
/* Calculate the real values from the rgrp information */
sdp->blks_total = 0;
sdp->blks_alloced = 0;
7 years, 4 months
cluster: STABLE32 - cman_tool: Improve on the last cman_tool nodes fix
by Christine Caulfield
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=1ac358de474...
Commit: 1ac358de4743de3bc401eac639ca88252231f3d9
Parent: b5c85f77a6e4dfd4237c12d4002464a429e5b59c
Author: Christine Caulfield <ccaulfie(a)redhat.com>
AuthorDate: Fri Nov 11 13:00:47 2016 +0000
Committer: Christine Caulfield <ccaulfie(a)redhat.com>
CommitterDate: Fri Nov 11 13:00:47 2016 +0000
cman_tool: Improve on the last cman_tool nodes fix
clang discoved an unitiialied variable error, and that revealed
that other things were wrong. now print 'none' for the qdiskd
'ip address' and avoid uninitialised fields.
Signed-off-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/cman_tool/main.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/cman/cman_tool/main.c b/cman/cman_tool/main.c
index 9aaac26..6946e9e 100644
--- a/cman/cman_tool/main.c
+++ b/cman/cman_tool/main.c
@@ -168,8 +168,10 @@ static void print_address(char *addr)
else
saddr = &sin->sin_addr;
- inet_ntop(ss->ss_family, saddr, buf, sizeof(buf));
- printf("%s", buf);
+ if (inet_ntop(ss->ss_family, saddr, buf, sizeof(buf)))
+ printf("%s", buf);
+ else
+ printf("none");
}
static char *membership_state(char *buf, int buflen, int node_state)
@@ -373,7 +375,7 @@ static void print_node(commandline_t *comline, cman_handle_t h, int *format, str
{
char member_type;
struct tm *jtime;
- int numaddrs;
+ int numaddrs=1;
struct cman_node_address addrs[MAX_INTERFACES];
char jstring[1024];
int i,j,k;
@@ -437,9 +439,6 @@ static void print_node(commandline_t *comline, cman_handle_t h, int *format, str
}
}
}
- else {
- printf("0.0.0.0");
- }
}
if (comline->format_opts && (cman_get_node_extra(h, node->cn_nodeid, &enode) == 0)) {
7 years, 4 months
cluster: STABLE32 - cman_tool: Don't segfault when taking address of
qdevice
by Christine Caulfield
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=b5c85f77a6e...
Commit: b5c85f77a6e4dfd4237c12d4002464a429e5b59c
Parent: 9b8e381474c4e7fcbdb192b516cb5a0dd41b1730
Author: Christine Caulfield <ccaulfie(a)redhat.com>
AuthorDate: Fri Oct 14 15:28:42 2016 +0100
Committer: Christine Caulfield <ccaulfie(a)redhat.com>
CommitterDate: Fri Oct 14 15:28:42 2016 +0100
cman_tool: Don't segfault when taking address of qdevice
If cman_tool nodes -F addr is called when qdevice is active then
cman_tool segfaults quite spectacularly when it tries to print
the address of the qdevice 'node'
Signed-off-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/cman_tool/main.c | 24 ++++++++++++++----------
1 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/cman/cman_tool/main.c b/cman/cman_tool/main.c
index 5596698..9aaac26 100644
--- a/cman/cman_tool/main.c
+++ b/cman/cman_tool/main.c
@@ -423,19 +423,23 @@ static void print_node(commandline_t *comline, cman_handle_t h, int *format, str
}
if (comline->addresses_opt || comline->format_opts) {
- if (!cman_get_node_addrs(h, node->cn_nodeid, MAX_INTERFACES, &numaddrs, addrs) &&
- numaddrs)
- {
- if (!comline->format_opts) {
- printf(" Addresses: ");
- for (i = 0; i < numaddrs; i++)
- {
- print_address(addrs[i].cna_address);
- printf(" ");
+ if (node->cn_nodeid > 0) {
+ if (!cman_get_node_addrs(h, node->cn_nodeid, MAX_INTERFACES, &numaddrs, addrs) &&
+ numaddrs) {
+ if (!comline->format_opts) {
+ printf(" Addresses: ");
+ for (i = 0; i < numaddrs; i++)
+ {
+ print_address(addrs[i].cna_address);
+ printf(" ");
+ }
+ printf("\n");
}
- printf("\n");
}
}
+ else {
+ printf("0.0.0.0");
+ }
}
if (comline->format_opts && (cman_get_node_extra(h, node->cn_nodeid, &enode) == 0)) {
7 years, 4 months
cluster: RHEL6 - rgmanager: Fix possible segfault in clustat
by Ryan McCabe
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=24e142a12dd...
Commit: 24e142a12dd3b3976cfd2227f2a1844698f5fbbe
Parent: 75a02d64a5f11f9a3f1d84a6606e693a259f8c5b
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Tue Nov 8 09:31:34 2016 -0500
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Tue Nov 8 09:31:34 2016 -0500
rgmanager: Fix possible segfault in clustat
Fix a segfault in clustat that could occur when failing to receive
the member list from ccs.
Resolves: rhbz#1079207
Signed-off-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/utils/clustat.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/rgmanager/src/utils/clustat.c b/rgmanager/src/utils/clustat.c
index 56e2a15..7688bbd 100644
--- a/rgmanager/src/utils/clustat.c
+++ b/rgmanager/src/utils/clustat.c
@@ -357,8 +357,10 @@ static cluster_member_list_t *ccs_member_list(void)
ccs_disconnect(desc);
ret->cml_members = nodes;
- qsort(ret->cml_members, ret->cml_count, sizeof(cman_node_t),
- member_id_sort);
+ if (ret->cml_members) {
+ qsort(ret->cml_members, ret->cml_count, sizeof(cman_node_t),
+ member_id_sort);
+ }
return ret;
}
7 years, 4 months
cluster: RHEL6 - rgmanager: Fix segfault when quorum is lost
by Ryan McCabe
Gitweb: http://git.fedorahosted.org/git/?p=cluster.git;a=commitdiff;h=75a02d64a5f...
Commit: 75a02d64a5f11f9a3f1d84a6606e693a259f8c5b
Parent: 24e5e65be1c9b8b433edc1723b4e13feba0db8ba
Author: Ryan McCabe <rmccabe(a)redhat.com>
AuthorDate: Tue Nov 1 11:43:47 2016 -0400
Committer: Ryan McCabe <rmccabe(a)redhat.com>
CommitterDate: Tue Nov 1 11:43:47 2016 -0400
rgmanager: Fix segfault when quorum is lost
Fix a segfault that could occur following recovery caused by a loss
of quorum.
Patch from John Ruemker <jruemker(a)redhat.com>
Resolves: rhbz#1367594
Signed-off-by: Ryan McCabe <rmccabe(a)redhat.com>
---
rgmanager/src/daemons/rg_state.c | 12 ++++++++++++
rgmanager/src/daemons/rg_thread.c | 2 +-
2 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/rgmanager/src/daemons/rg_state.c b/rgmanager/src/daemons/rg_state.c
index fe5d99d..2527f19 100644
--- a/rgmanager/src/daemons/rg_state.c
+++ b/rgmanager/src/daemons/rg_state.c
@@ -905,6 +905,8 @@ svc_migrate(const char *svcName, int target)
return RG_EINVAL;
membership = member_list();
+ if (!membership)
+ return RG_EFAIL;
m = memb_id_to_p(membership, target);
if (!m) {
free_member_list(membership);
@@ -1815,6 +1817,8 @@ handle_relocate_req(char *svcName, int orig_request, int preferred_target,
/* TODO: simplify this and don't keep alloc/freeing
member lists */
allowed_nodes = member_list();
+ if (!allowed_nodes)
+ return RG_EFAIL;
m = memb_id_to_p(allowed_nodes, preferred_target);
if (m && m->cn_member) {
@@ -1849,6 +1853,8 @@ handle_relocate_req(char *svcName, int orig_request, int preferred_target,
if (preferred_target > 0) {
allowed_nodes = member_list();
+ if (!allowed_nodes)
+ return RG_EFAIL;
/*
Mark everyone except me and the preferred target DOWN for now
If we can't start it on the preferred target, then we'll try
@@ -1927,6 +1933,8 @@ handle_relocate_req(char *svcName, int orig_request, int preferred_target,
allowed_nodes = member_list();
//count_resource_groups(allowed_nodes);
}
+ if (!allowed_nodes)
+ return RG_EFAIL;
member_list_shuffle(allowed_nodes);
if (preferred_target > 0)
@@ -2081,6 +2089,8 @@ handle_start_req(char *svcName, int req, int *new_owner)
need_check = have_exclusive_resources();
membership = member_list();
+ if (!membership)
+ return RG_EFAIL;
/*
* When a service request is from a user application (eg, clusvcadm),
@@ -2218,6 +2228,8 @@ handle_start_remote_req(char *svcName, int req)
need_check = have_exclusive_resources();
membership = member_list();
+ if (!membership)
+ return RG_EFAIL;
/* XXX ok, so we need to say "should I start this if I was the
only cluster member online */
diff --git a/rgmanager/src/daemons/rg_thread.c b/rgmanager/src/daemons/rg_thread.c
index c08d8aa..6f06b6f 100644
--- a/rgmanager/src/daemons/rg_thread.c
+++ b/rgmanager/src/daemons/rg_thread.c
@@ -219,7 +219,7 @@ resgroup_thread_main(void *arg)
while(1) {
pthread_mutex_lock(&reslist_mutex);
pthread_mutex_lock(&my_queue_mutex);
- if ((req = rq_next_request(&my_queue)) == NULL) {
+ if (!rg_quorate() || (req = rq_next_request(&my_queue)) == NULL) {
/* We're done. No more requests.
We're about to kill our thread, so exit the
loop with the lock held. */
7 years, 4 months