1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Limit max size of clvmd message

This could be seen as some sort of simple validation - it's not easy to
recognize a valid message for now - but we definitely do not want to
allocate a lot of megabytes in  clvmd memory locked daemon when broken
message gets in.

Size of 8000 is just selected for now - possibly there could be much
lower value put in.
This commit is contained in:
Zdenek Kabelac 2012-02-28 09:58:19 +00:00
parent 9ef8d6617e
commit da0f745cb6
2 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.94 - Version 2.02.94 -
==================================== ====================================
Limit the max size of processed clvmd message to ~8KB.
Do not send uninitilised bytes in cluster error reply messages. Do not send uninitilised bytes in cluster error reply messages.
Use unsigned type for bitmask instead of enum type for lvm properties. Use unsigned type for bitmask instead of enum type for lvm properties.
Add missing cleanup of excl_uuid hash on some exit paths of clvmd. Add missing cleanup of excl_uuid hash on some exit paths of clvmd.

View File

@ -49,6 +49,7 @@
#endif #endif
#define MAX_RETRIES 4 #define MAX_RETRIES 4
#define MAX_MISSING_LEN = 8000 /* Max supported clvmd message size ? */
#define ISLOCAL_CSID(c) (memcmp(c, our_csid, max_csid_len) == 0) #define ISLOCAL_CSID(c) (memcmp(c, our_csid, max_csid_len) == 0)
@ -1204,7 +1205,8 @@ static int read_from_local_sock(struct local_client *thisfd)
missing_len = 0; missing_len = 0;
/* We need at least sizeof(struct clvm_header) bytes in buffer */ /* We need at least sizeof(struct clvm_header) bytes in buffer */
if (len < sizeof(struct clvm_header) || argslen < 0) { if (len < sizeof(struct clvm_header) || argslen < 0 ||
missing_len > MAX_MISSING_LEN) {
struct clvm_header reply = { struct clvm_header reply = {
.cmd = CLVMD_CMD_REPLY, .cmd = CLVMD_CMD_REPLY,
.status = EINVAL .status = EINVAL