Commit 692f51c8 authored by Alexander Aring's avatar Alexander Aring Committed by David Teigland

fs: dlm: add get buffer error handling

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: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent 9f8f9c77
...@@ -1352,6 +1352,12 @@ void *dlm_lowcomms_get_buffer(int nodeid, int len, gfp_t allocation, char **ppc) ...@@ -1352,6 +1352,12 @@ void *dlm_lowcomms_get_buffer(int nodeid, int len, gfp_t allocation, char **ppc)
struct writequeue_entry *e; struct writequeue_entry *e;
int offset = 0; int offset = 0;
if (len > LOWCOMMS_MAX_TX_BUFFER_LEN) {
BUILD_BUG_ON(PAGE_SIZE < LOWCOMMS_MAX_TX_BUFFER_LEN);
log_print("failed to allocate a buffer of size %d", len);
return NULL;
}
con = nodeid2con(nodeid, allocation); con = nodeid2con(nodeid, allocation);
if (!con) if (!con)
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment