From: Alexander Aring Date: Mon, 1 Mar 2021 22:05:14 +0000 (-0500) Subject: fs: dlm: change allocation limits X-Git-Tag: accepted/tizen/unified/20230118.172025~7321^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c45674fbdda138814ca21138475219c96fa5aa1f;p=platform%2Fkernel%2Flinux-rpi.git fs: dlm: change allocation limits 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. Also use DEFAULT_BUFFER_SIZE as maximum allocation limit. The define LOWCOMMS_MAX_TX_BUFFER_LEN is to calculate maximum buffer limits on application layer, future midcomms layer will subtract their needs from this define. Signed-off-by: Alexander Aring Signed-off-by: David Teigland --- diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 4f2245e..206bd30 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1376,9 +1376,11 @@ 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) { - BUILD_BUG_ON(PAGE_SIZE < LOWCOMMS_MAX_TX_BUFFER_LEN); + if (len > DEFAULT_BUFFER_SIZE || + len < sizeof(struct dlm_header)) { + BUILD_BUG_ON(PAGE_SIZE < DEFAULT_BUFFER_SIZE); log_print("failed to allocate a buffer of size %d", len); + WARN_ON(1); return NULL; }