From: Alexander Aring Date: Fri, 18 Sep 2020 10:27:25 -0400 Subject: [Cluster-devel] [PATCH dlm/next 3/6] fs: dlm: disallow buffer size below default In-Reply-To: <20200918142728.147392-1-aahringo@redhat.com> References: <20200918142728.147392-1-aahringo@redhat.com> Message-ID: <20200918142728.147392-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 I observed dlm messages cannot below this value delivered from upper layers. This buffer is used inside the current receive handling to copy a dlm message into it. However we should not allow sizes below the default value. Signed-off-by: Alexander Aring --- fs/dlm/config.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/fs/dlm/config.c b/fs/dlm/config.c index 2b30104a34cef..1734f2e861924 100644 --- a/fs/dlm/config.c +++ b/fs/dlm/config.c @@ -166,8 +166,14 @@ static bool dlm_check_zero(unsigned int x) return !x; } +#define DEFAULT_BUFFER_SIZE 4096 +static bool dlm_check_buffer_size(unsigned int x) +{ + return (x < DEFAULT_BUFFER_SIZE); +} + CLUSTER_ATTR(tcp_port, dlm_check_zero); -CLUSTER_ATTR(buffer_size, dlm_check_zero); +CLUSTER_ATTR(buffer_size, dlm_check_buffer_size); CLUSTER_ATTR(rsbtbl_size, dlm_check_zero); CLUSTER_ATTR(recover_timer, dlm_check_zero); CLUSTER_ATTR(toss_secs, dlm_check_zero); @@ -897,7 +903,6 @@ int dlm_our_addr(struct sockaddr_storage *addr, int num) /* Config file defaults */ #define DEFAULT_TCP_PORT 21064 -#define DEFAULT_BUFFER_SIZE 4096 #define DEFAULT_RSBTBL_SIZE 1024 #define DEFAULT_RECOVER_TIMER 5 #define DEFAULT_TOSS_SECS 10 -- 2.26.2