[pve-devel] [RFC cluster] pmxcfs: fix segfault in cfs_create_status_msg

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Jun 13 15:22:05 CEST 2017


it's possible to request a status message for a no longer
existing nodename in a standalone setting (e.g., node was
renamed after pmxcfs was started).

Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
a scenario that can trigger this:
https://forum.proxmox.com/threads/strange-bug-in-5b2-pvesh-disables-the-web-ui.35016/

RFC because I am not really that "at home" within the pmxcfs code base, if
there is a better way to handle this it's fine by me ;)

 data/src/status.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/data/src/status.c b/data/src/status.c
index 5fe1eb9..030c003 100644
--- a/data/src/status.c
+++ b/data/src/status.c
@@ -1299,7 +1299,7 @@ cfs_create_status_msg(
 
 	if (!nodename || !nodename[0] || !strcmp(nodename, cfs.nodename)) {
 		kvhash = cfs_status.kvhash;
-	} else {
+	} else if (cfs_status.clinfo && cfs_status.clinfo->nodes_byname) {
 		cfs_clnode_t *clnode;
 		if ((clnode = g_hash_table_lookup(cfs_status.clinfo->nodes_byname, nodename)))
 			kvhash = clnode->kvhash;
-- 
2.11.0





More information about the pve-devel mailing list