From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Aring Date: Fri, 13 Nov 2020 17:58:01 -0500 Subject: [Cluster-devel] [RFC PATCH dlm/next 03/16] fs: dlm: add check for minimum allocation length In-Reply-To: <20201113225814.461167-1-aahringo@redhat.com> References: <20201113225814.461167-1-aahringo@redhat.com> Message-ID: <20201113225814.461167-4-aahringo@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit While running tcpkill I experienced invalid header length values while receiving to check that a node doesn't try to send a invalid dlm message we also check on applications minimum allocation limit. Signed-off-by: Alexander Aring --- fs/dlm/lowcomms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index ffea14c50d46..3ab56272ee2d 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1355,7 +1355,8 @@ void *dlm_lowcomms_get_buffer(int nodeid, int len, gfp_t allocation, char **ppc) struct writequeue_entry *e; int offset = 0; - if (len > LOWCOMMS_MAX_TX_BUFFER_LEN) { + if (len > LOWCOMMS_MAX_TX_BUFFER_LEN || + len < sizeof(struct dlm_header)) { BUILD_BUG_ON(PAGE_SIZE < LOWCOMMS_MAX_TX_BUFFER_LEN); log_print("failed to allocate a buffer of size %d", len); return NULL; -- 2.26.2