Skip to contentSkip to conversation

cluster cman/daemon/commands.c fence/fenced/me ...

Cluster-devel [email protected] 1 participant 1 message Aug 31, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: rmccabe at sourceware.org 2007-08-31 14:26:04

Modified files:

	cman/daemon    : commands.c 
	fence/fenced   : member_cman.c recover.c 
	group/daemon   : joinleave.c 

Log message:
fix 267441: Possible NULL pointer deferences in cman

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cman/daemon/commands.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.55.2.8&r2=1.55.2.9
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/member_cman.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.15.2.1&r2=1.15.2.2
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/fence/fenced/recover.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.25.2.2&r2=1.25.2.3
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/daemon/joinleave.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.19&r2=1.19.2.1

cman/daemon/commands.c +2 -1
@@ -1805,7 +1805,8 @@
 	case CLUSTER_MSG_PORTSTATUS:
 		if (nodeid != us->node_id) {
 			P_MEMB("got PORTRESULT from %d, low bytes = %x %x\n", data[1], data[2]);
-			memcpy(node->port_bits, data+1, PORT_BITS_SIZE);
+			if (node)
+				memcpy(node->port_bits, data+1, PORT_BITS_SIZE);
 		}
 		break;
 
fence/fenced/member_cman.c +1 -1
@@ -199,7 +199,7 @@
 	}
 
 	/* If this call fails (though it shouldn't) then regard the node as unfenced */
-	if (cman_get_fenceinfo(ch, cn->cn_nodeid, &fence_time, &fenced, agent)) {
+	if (cn && cman_get_fenceinfo(ch, cn->cn_nodeid, &fence_time, &fenced, agent)) {
 		log_debug("cman_get_fenceinfo failed: %s", strerror(errno));
 		fenced = 0;
 	}
fence/fenced/recover.c +5 -3
@@ -218,9 +218,11 @@
 static inline void close_override(int *fd, char *path)
 {
 	unlink(path);
-	if (fd && *fd >= 0)
-		close(*fd);
-	*fd = -1;
+	if (fd) {
+		if (*fd >= 0)
+			close(*fd);
+		*fd = -1;
+	}
 }
 
 static int open_override(char *path)
group/daemon/joinleave.c +6 -0
@@ -61,6 +61,8 @@
 	app_t *a;
 
 	a = malloc(sizeof(app_t));
+	if (!a)
+		return NULL;
 	memset(a, 0, sizeof(app_t));
 
 	a->need_first_event = 1;
@@ -90,6 +92,10 @@
 		goto out;
 
 	a = create_app(g);
+	if (!a) {
+		rv = -ENOMEM;
+		goto out;
+	}
 
 	a->client = ci;