VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   33 Branches   57 Tags
author: Alexander Aring <aahringo@redhat.com> 2020-11-02 20:04:18 -0500 committer: David Teigland <teigland@redhat.com> 2020-11-10 12:14:20 -0600 commit: 692f51c8cbe752cb16ea2a75016ea0a497d00b1c parent: 9f8f9c774ad10aa1c15952c36f580d7e3711a100
Commit Summary:
fs: dlm: add get buffer error handling
Diffstat:
1 file changed, 6 insertions, 0 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 77382c2ce6da..620eca3979d5 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1352,6 +1352,12 @@ 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);
+		log_print("failed to allocate a buffer of size %d", len);
+		return NULL;
+	}
+
 	con = nodeid2con(nodeid, allocation);
 	if (!con)
 		return NULL;