From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Aring Date: Mon, 19 Oct 2020 14:59:10 -0400 Subject: [Cluster-devel] [PATCH dlm/next 3/9] fs: dlm: add get buffer error handling In-Reply-To: <20201019185916.707827-1-aahringo@redhat.com> References: <20201019185916.707827-1-aahringo@redhat.com> Message-ID: <20201019185916.707827-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 This patch adds an error handling to the get buffer functionality if the user is requesting a buffer length which is more than possible of the internal buffer allocator. This should never happen because specific handling decided by compile time, but will warn if somebody forget about to handle this limitation right. Signed-off-by: Alexander Aring --- fs/dlm/lowcomms.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 77382c2ce6da2..0e29242620136 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c @@ -1352,6 +1352,11 @@ void *dlm_lowcomms_get_buffer(int nodeid, int len, gfp_t allocation, char **ppc) struct writequeue_entry *e; int offset = 0; + if (len > PAGE_SIZE) { + log_print("failed to allocate a buffer of size %d", len); + return NULL; + } + con = nodeid2con(nodeid, allocation); if (!con) return NULL; -- 2.26.2