summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2011-03-29 21:05:39 +0000
committerZdenek Kabelac <zkabelac@redhat.com>2011-03-29 21:05:39 +0000
commit7f0d89f8b4d70b5229f6ae93e81e985175e82e62 (patch)
treee46c16defa532429aca612df58a914004087fdbe
parentaaf92617b0ad642ec99483141ad588982cf921d8 (diff)
downloadlvm2-7f0d89f8b4d70b5229f6ae93e81e985175e82e62.tar.gz
lvm2-7f0d89f8b4d70b5229f6ae93e81e985175e82e62.tar.xz
lvm2-7f0d89f8b4d70b5229f6ae93e81e985175e82e62.zip
Fix sending uninitilised bytes in cluster messages
Fix 2 more functions sending cluster messages to avoid passing uninitilised bytes and compensate 1 extra byte attached to the message from the clvm_header.args[1] member variable.
-rw-r--r--WHATS_NEW2
-rw-r--r--daemons/clvmd/refresh_clvmd.c6
-rw-r--r--lib/locking/cluster_locking.c6
3 files changed, 9 insertions, 5 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 5cb82e65..cfd58443 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -20,7 +20,7 @@ Version 2.02.85 -
Avoid possible endless loop in _free_vginfo when 4 or more VGs have same name.
Use empty string instead of /dev// for LV path when there's no VG.
Don't allocate unused VG mempool in _pvsegs_sub_single.
- Remove uninitialised byte from end of local clvmd messages.
+ Do not send uninitialised bytes in local clvmd messages.
Support --help option for clvmd and return error for unknown option.
Use system page size and not hardcoded value in locking code check.
Fix reading of released memory for printing segment type.
diff --git a/daemons/clvmd/refresh_clvmd.c b/daemons/clvmd/refresh_clvmd.c
index 1e88b5cc..9c0fb4fb 100644
--- a/daemons/clvmd/refresh_clvmd.c
+++ b/daemons/clvmd/refresh_clvmd.c
@@ -154,6 +154,7 @@ static void _build_header(struct clvm_header *head, int cmd, const char *node,
head->cmd = cmd;
head->status = 0;
head->flags = 0;
+ head->xid = 0;
head->clientid = 0;
head->arglen = len;
@@ -197,11 +198,12 @@ static int _cluster_request(char cmd, const char *node, void *data, int len,
if (_clvmd_sock == -1)
return 0;
- _build_header(head, cmd, node, len);
+ /* 1 byte is used from struct clvm_header.args[1], so -> len - 1 */
+ _build_header(head, cmd, node, len - 1);
memcpy(head->node + strlen(head->node) + 1, data, len);
status = _send_request(outbuf, sizeof(struct clvm_header) +
- strlen(head->node) + len, &retbuf, no_response);
+ strlen(head->node) + len - 1, &retbuf, no_response);
if (!status || no_response)
goto out;
diff --git a/lib/locking/cluster_locking.c b/lib/locking/cluster_locking.c
index 4dac05f9..99ac4125 100644
--- a/lib/locking/cluster_locking.c
+++ b/lib/locking/cluster_locking.c
@@ -173,6 +173,7 @@ static void _build_header(struct clvm_header *head, int clvmd_cmd, const char *n
head->cmd = clvmd_cmd;
head->status = 0;
head->flags = 0;
+ head->xid = 0;
head->clientid = 0;
head->arglen = len;
@@ -216,11 +217,12 @@ static int _cluster_request(char clvmd_cmd, const char *node, void *data, int le
if (_clvmd_sock == -1)
return 0;
- _build_header(head, clvmd_cmd, node, len);
+ /* 1 byte is used from struct clvm_header.args[1], so -> len - 1 */
+ _build_header(head, clvmd_cmd, node, len - 1);
memcpy(head->node + strlen(head->node) + 1, data, len);
status = _send_request(outbuf, sizeof(struct clvm_header) +
- strlen(head->node) + len, &retbuf);
+ strlen(head->node) + len - 1, &retbuf);
if (!status)
goto out;