Skip to content

Commit ff58d1c

Browse files
alexaringgregkh
authored andcommitted
fs: dlm: check on minimum msglen size
[ Upstream commit 710176e ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent ca973d2 commit ff58d1c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

‎fs/dlm/midcomms.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int len)
4949
* cannot deliver this message to upper layers
5050
*/
5151
msglen = get_unaligned_le16(&hd->h_length);
52-
if (msglen > DEFAULT_BUFFER_SIZE) {
53-
log_print("received invalid length header: %u, will abort message parsing",
54-
msglen);
52+
if (msglen > DEFAULT_BUFFER_SIZE ||
53+
msglen < sizeof(struct dlm_header)) {
54+
log_print("received invalid length header: %u from node %d, will abort message parsing",
55+
msglen, nodeid);
5556
return -EBADMSG;
5657
}
5758

0 commit comments

Comments
 (0)