diff options
author | Alexander Aring <aahringo@redhat.com> | 2021-03-01 17:05:17 -0500 |
---|---|---|
committer | David Teigland <teigland@redhat.com> | 2021-03-09 08:56:42 -0600 |
commit | 710176e8363f269c6ecd73d203973b31ace119d3 (patch) | |
tree | 986e3d5ea931cd881c7c3c9c50f4c1788b87d01d /fs/dlm | |
parent | f0747ebf48f362ebfc93bc383d6be2b8c8f05b5a (diff) |
fs: dlm: check on minimum msglen size
This patch adds an additional check for minimum dlm header size which is
an invalid dlm message and signals a broken stream. A msglen field cannot
be less than the dlm header size because the field is inclusive header
lengths.
Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm')
-rw-r--r-- | fs/dlm/midcomms.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c index fde3a6afe4be..0bedfa8606a2 100644 --- a/fs/dlm/midcomms.c +++ b/fs/dlm/midcomms.c @@ -49,9 +49,10 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int len) * cannot deliver this message to upper layers */ msglen = get_unaligned_le16(&hd->h_length); - if (msglen > DEFAULT_BUFFER_SIZE) { - log_print("received invalid length header: %u, will abort message parsing", - msglen); + if (msglen > DEFAULT_BUFFER_SIZE || + msglen < sizeof(struct dlm_header)) { + log_print("received invalid length header: %u from node %d, will abort message parsing", + msglen, nodeid); return -EBADMSG; } |